每日 Widget
Flutter Widget 简介:这个仓库将教你一些 Flutter SDK 中常用的 Widget,并展示如何将它们用于你的 UI 设计。播放列表 URL
- YouTube
- YouTube [LinearGradient]
- YouTube [Card]
- YouTube [Clipper]
- YouTube [CustomPaint]
- YouTube [DataTable]
- YouTube [Hero_Animation]
- YouTube [Stepper_To_SelectableText]
- YouTube [ClipPath (Bezier Curves)]
- YouTube [InheritedWidget]
Widget 列表
- Container > 简介 > 新形态设计
- Expanded > 动态布局 > Column 和 Row 内部的布局改变
- Column > mainAxisAlignment 和 crossAxisAlignment Row > alignment
- ListView > Builder > Instagram UI 设计
- SingleChildScrollView > scrollDirection > padding > physics
- Image.Asset > fit (BoxFit.cover) > 将其放在 Container Widget 中以实现圆角
- Gridview > Builder > crossAxisCount (水平方向的框数量)
- GestureDetector > onTap:()=>{‘action’} > 将功能逻辑与 UI 分开
- BottomNavBar > StateStatefulWidget > type: BottomNavigationBarType.fixed > 页面列表
- AppBar > backgroundColor: Colors.transparent > leading (左侧定位) > actions (右侧定位)
- Drawer > 始终在 ListView 中 > DrawerHeader > ListTile > endDrawer (右侧抽屉)
- SliverAppBar > CustomScrollView > SliverAppBar > expandedHeight > SliverToBoxAdapter SliverAppBar 的属性:flexibleSpace > floating (默认为 'false') > pinned (默认为 'false')
- TabBar > 使用 'DefaultTabController' 包裹 Scaffold > length (项目数量) > TabBar TabBarView > Container > 使用 'Expanded' 包裹 TabBarView 以控制 Container 大小
- AnimatedContainer > GestureDetector > onTap (激活动画) > duration (动画执行时间,单位“秒”) > Container > Alignment
- MediaQuery > Height > Width > Aspect Ratio > Orientation
- AlertDialog > MaterialButton > onPressed:_showDialog > AlertDialog(title, content, actions) > CupertinoAlertDialog (用于 iOS 设备)
- Text > style > TextStyle > fontStyle: FontStyle.italic > fontWeight > theme (用于设置默认样式)
- RichText > TextSpan > 默认样式 > children > 多个 'TextSpan' Widget
- Timer > StatefulWidget > Text > MaterialButton > onPressed: _startCountDown > Timer.periodic
- PageView > controller > scrollDirection: Axis.vertical > 不同的 Post 页面
- Stack > alignment: Alignment.center (默认 Alignment.topLeft)
- TextField > StatefulWidget > _textController > TextField > controller: _textController > decoration > onPressed > suffixIcon > _textController.clear() > Expanded > userPost
- AnimatedIcon > StatefulWidget > with SingleTickerProviderStateMixin > late AnimationController _animationController > 阅读代码
- Slider > StatefulWidget > Slider(value: value, onChanged: onChanged) > Slider Widget 的许多颜色参数
- DatePicker > StatefulWidget > DateTime 变量 > _showDatePicker > 阅读代码
- TimePicker > StatefulWidget > TimeOfDay 变量 > _showTimePicker > 阅读代码
- ListWheelScrollView > StatefulWidget > itemExtent > perspective > diameterRatio > physics: const FixedExtentScrollPhysics() > onSelectedItemChanged > 阅读代码
- LinearGradient > Container > decoration > BoxDecoration > gradient > LinearGradient
- ElevatedButton > style > ElevatedButton.styleFrom > primary: Colors.blue OutlinedButton
- FloatingActionButton
- RawMaterialButton > 用于自定义炫酷按钮
- IconButton
- Navigator > initialRoute > ElevatedButton > Navigator.pushNamed(context, ‘/first’) > Navigator.pop(context)
- Card > shape: RoundedRectangleBorder > borderRadius: BorderRadius.circular(20) > Column > children[] > shadowColor > elevation
- Clipper > Custom Clipper > Quadratic Bezier Curve
- RotatedBox > quarterTurns: 3 > 每个 quarterTurns 等于 90°
- Transform > origin > transform
- Positioned > Stack > alignment > Positioned > 一次最多使用 2 个属性
- CustomPaint > 观看视频
- ClipOval > Image.asset > height 和 width 应该相同 > fit: BoxFit.cover
- ClipRRect > borderRadius > Image.asset
- ClipRect > Image.asset
- ClipPath > ClipPath > clipper: CustomClipPath() > Path getClip(Size size){} > shouldReclip(CustomClipper< Path> oldClipper)
- Radial & Sweep Gradient > Container > decoration > gradient > RadialGradient / SweepGradient
- StatefulWidget > createState() > initState() > didChangeDependencies() > didUpdateWidget() > deactivate() > dispose() > setState((){‘actions’})
- Table > border > columnWidths > textDirection > children > TableRow > children
- DataTable > border > columnSpacing > onSelectAll > sortColumnIndex > sortAscending > columns > rows
- Placeholder > fallbackHeight > strokeWidth > color > strokeWidth
- GestureDetector & InkWell > GestureDetector > onTap | InkWell > OnTap
- Material > 它可以操作其子 Widget 的一些属性
- Switches > ListTile > leading > Switch / Checkbox / Radio > value > onChanged > groupValue (仅用于 Radio)
- DropDown&Popup > 查看代码
- HeroAnimation > tag: 两个页面中的 item
- AboutDialog > ElevatedButton > onPressed > showAboutDialog
- Stepper > int _currentStep = 0 > Stepper > Step (带有 title: 和 content:) > onStepTapped > currentStep: _currentStep > onStepContinue > onStepCancel
- FittedBox > 将文本适配到容器中
- show Search > AppBar > actions > IconButton > onPressed: () {showSearch()}
- .adaptive > Slider.adaptive > SwitchListTile.adaptive > Switch.adaptive > Icon(Icons.adaptive.share) > CircularProgressIndicator.adaptive()
- Scrollbar > isAlwaysShown: true > thickness: 10 > ListView.builder / GridView.builder
- ChoiceChip > ChoiceChip > avatar > label > selected > onSelected
- Wrap > Wrap > children
- ExpansionTile > title > children: > ListTile
- RangeSlider > values > divisions > labels > onChanged
- showModelBottomSheet > showModalBottomSheet > context: context, > builder: (BuildContext context) > return > SizedBox
- AnimatedCrossFade > firstChild > secondChild > crossFadeState > duration
- Flexible > flex > fit
- Spacer > flex: 1
- GridPaper > color: Colors.deepPurple
- InteractiveViewer > maxScale > child: Image.asset()
- CheckboxListTile > title > subtitle > value
- SelectableText > SelectableText > 查看代码
- AnimatedPadding > padding: EdgeInsets.all(padValue) > duration
- RefreshIndicator > color > backgroundColor > onRefresh
- ImageFiltered > import ‘dart:ui’; > ImageFiltered > imageFilter: ImageFilter.blur(sigmaX: 8),
- AspectRatio > aspectRatio: 3 / 2 > child
- ToggleButton > children:[] > isSelected > onPressed
- Physical Model > color > elevation
- Align > Container > child: > Align > alignment: Alignment(0.60, -0.80)
- SafeArea > Scaffold > body: > SafeArea
- PageRouteBuilder > 查看代码
- Draggable > DragTarget > onAccept > builder
- BackdropFilter > Stack > Image.asset > Positioned > BackdropFilter > ImageFilter.blur()
- ReorderableListView > itemCount > onReorder > itemBuilder
- FadeTransition > FadeTransition > opacity: _animation!
- CircleAvatar > radius: > backgroundImage: AssetImage()
- Tooltip > message: > verticalOffset: > height: > Child
- Visibility > visible: isVisible > child: Image.asset(”)
- IndexedStack > index: index > children
- Navigator 2.0 > 查看代码
- Null Aware Operators > 查看代码
- Cascade Operator > 查看代码
- Inherited Widget > 查看代码
- Fractionally Sizedbox
- Constrained Box > 查看代码
- Cupertino Search > late TextEditingController textController > CupertinoSearchTextField > placeholder > controller
- Stateful Builder > builder: (context, internalState) > internalState(() { counter++;})
- Layout Builder > builder: (BuildContext context, BoxConstraints constraints){ return }
- Orientation Builder > builder: (context, orientation){}
- Platform Detect > import ‘dart:io’ show Platform;
- FutureBuilder > FutureBuilder > future: getData() > builder
- StreamBuilder > StreamBuilder > stream > initialData > builder
- ChangeNotifier > CNController extends ChangeNotifier > notifyListeners()
- ValueNotifier > final ValueNotifier< int> count = ValueNotifier< int>(0) > ValueListenableBuilder()
- InheritedNotifier > 查看代码





































































































