Flutter20个小实例免费视频教程
https://www.bilibili.com/video/BV1kt411B7mu
P1 01节底部导航栏和切換效果的制作-1
Scaffold脚手架
动态flutter 快捷键 stful
P2 02节底部导航栏和切换效果的制作-2
import 'package:flutter/material.dart';
import 'pages/airplay_screen.dart';
import 'pages/email_screen.dart';
import 'pages/pages_screen.dart';
import 'pages/home_screen.dart';
class BottomNavigationWidget extends StatefulWidget {
const BottomNavigationWidget({super.key});
@override
State<BottomNavigationWidget> createState() => _BottomNavigationWidgetState();
}
class _BottomNavigationWidgetState extends State<BottomNavigationWidget> {
final _BottomNavigationColor = Colors.blue;
int _currentIndex = 0;
// List<Widget> list=List();//old
List<Widget> list = <Widget>[];
@override
void initState() {
list
..add(HomeScreen())
..add(EmailScreen())
..add(PagesScreen())
..add(AirplayScreen());
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: list[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
fixedColor: Colors.red, //current item
type: BottomNavigationBarType.fixed, //item > 3时必须要设置,不然未选中项字体颜色变白
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
currentIndex: _currentIndex,
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home,
color: _BottomNavigationColor,
),
// title: Text('Home')),//old
label: 'Home'),
BottomNavigationBarItem(
icon: Icon(
Icons.email,
color: _BottomNavigationColor,
),
// title: Text('Home')),//old
label: 'Email'),
BottomNavigationBarItem(
icon: Icon(
Icons.pages,
color: _BottomNavigationColor,
),
// title: Text('Home')),//old
label: 'Pages'),
BottomNavigationBarItem(
icon: Icon(
Icons.airplay,
color: _BottomNavigationColor,
),
// title: Text('Home')),//old
label: 'Airplay'),
],
),
);
}
}
P3 03节不规则底部工具栏的制作-1
P4 04节不规则底部工具栏的制作-2
P5 05节路由跳转的动画效果1
P6 06节路由跳转的动画效果2
import 'package:flutter/material.dart';
class CustomeRouter extends PageRouteBuilder {
final Widget widget;
CustomeRouter(this.widget)
: super(
transitionDuration: Duration(seconds: 1),
pageBuilder: (
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
) {
return widget;
},
transitionsBuilder: (BuildContext Context,
Animation<double> animation1,
Animation<double> animation2,
Widget child) {
//渐隐渐显的路由动画效果
// return FadeTransition(
// opacity: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
// parent: animation1, curve: Curves.fastOutSlowIn)),
// child: child,
// );
//缩放的动画效果
// return ScaleTransition(
// scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
// parent: animation1, curve: Curves.fastOutSlowIn)),
// child: child,
// );
//旋转+缩放动画效果
// return RotationTransition(
// turns: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
// parent: animation1, curve: Curves.fastOutSlowIn)),
// child: ScaleTransition(
// scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
// parent: animation1, curve: Curves.fastOutSlowIn)),
// child: child,
// ),
// );
//左右滑动动画
return SlideTransition(
position: Tween<Offset>(
begin: Offset(-1.0, 0.0), end: Offset(0.0, 0.0))
.animate(CurvedAnimation(
parent: animation1, curve: Curves.fastOutSlowIn)),
child: child,
);
});
}
P7 07节磨砂玻璃的效果制作
Fliter Widget 消耗性能
import 'package:flutter/material.dart';
import 'dart:ui';
class FrostedGlassDemo extends StatelessWidget {
const FrostedGlassDemo({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
ConstrainedBox(
constraints: BoxConstraints.expand(),
child: Image.network(
'https://img0.baidu.com/it/u=3827844244,2735061184&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1722531600&t=b10aa9435310a27ec847a535b6894521'),
),
Center(
child: ClipRect(
//可裁切的矩形
child: BackdropFilter(
//背景过滤器
filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
child: Opacity(
opacity: 0.5,
child: Container(
width: 500.0,
height: 700.0,
decoration: BoxDecoration(color: Colors.grey.shade200),
child: Center(
child: Text(
'KooTeam',
style: Theme.of(context).textTheme.displayLarge,
),
),
),
),
),
),
)
],
),
);
}
}
P8 08节保持页面状态-1
P9 09节保持页面状态-2
keep alive
P10 10节不简单的搜索条-1
P11 11节不简单的搜索条-2
P12 12节Wrap流式布局
P13 13节展开闭合案例ExpansionTile控件
ExpansionTile 折叠tab
P14 14节展开闭合列表案例ExpansionPanelList控件
P15 15节路径裁切和二次贝塞尔曲线的讲解
P16 16节路径裁切浪型贝塞尔曲线绘制
P17 17节APP闪屏动画制作
P18 18节右滑返回上一页效果制作
P19 19节轻量级提示操作ToolTip
P20 20节Draggable拖拽控件讲解和实例演示
命令行 r 热更新
大写R 去缓存更新
标签:return,0.0,Flutter20,dart,实例,animation1,child,import,视频教程 From: https://www.cnblogs.com/KooTeam/p/18606825