视频直播系统源码,平台在日间和夜间模式之间来回切换实现的相关代码
import 'package:Flutter/material.dart';
import 'package:Flutter_widget/router/applicationRouterGradual.dart';
import 'package:Flutter_widget/router/applicationRouterSlide.dart';
import 'package:Flutter_widget/widget/layout.dart';
class HomeContent extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// Todo: implement createState
return _HomeContentState();
}
}
class _HomeContentState extends State<HomeContent> {
final List arrayRouter = [
{
'router': '/statelessWidget',
'title': 'statelessWidget 容器组件',
'desc': 'statelessWidget 容器组件'
},
{
'router': '/statefulWidget',
'title': 'statefulWidget 容器组件',
'desc': 'statefulWidget 容器组件'
},
{
'router': '/statefulWidget',
'title': 'statefulWidget 容器组件',
'desc': 'statefulWidget 容器组件'
},
{
'router': '/gesturePage',
'title': 'Flutter 手势识别',
'desc': 'Flutter 手势识别',
},
{
'router': '/assetsSource',
'title': 'Flutter 资源加载',
'desc': 'Flutter 资源加载',
},
{
'router': '/openApplicaiton',
'title': 'Flutter 打开第三方应用',
'desc': 'Flutter 打开第三方应用',
},
{
'router': '/FlutterLife',
'title': 'Flutter Widget 生命周期',
'desc': 'Flutter Widget 生命周期',
},
{
'router': '/FlutterApplicationLife',
'title': 'Flutter 应用 生命周期',
'desc': 'Flutter 应用 生命周期',
},
];
bool modelDay = true;
Brightness appBrightness = Brightness.light;
@override
Widget build(BuildContext context) {
// Todo: implement build
return MaterialApp(
title: 'Flutter 基础学习',
theme: ThemeData(
// fontFamily: 'TianShi',//全局字体设置
brightness: appBrightness,
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text("Flutter 组件的学习"),
actions: [
Center(child: Text("主题切换")),
Switch(
activeColor: Colors.orange,
value: modelDay,
onChanged: (value) {
setState(() { //切换主题
this.modelDay = value;
appBrightness =
this.modelDay ? Brightness.light : Brightness.dark;
});
})
],
),
body: SingleChildScrollView(
child: Center(
child: Column(
children: arrayRouter
.map(
(item) => MaterialButton(
onpressed: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => Layout()));
Navigator.pushNamed(context, item['router'],
arguments: {'desc': item['desc']});
//Navigator.push(context, ApplicationRouterGradual())
// Navigator.push(context,
// ApplicationRouterGradual(widget: LessGroupPage()));
// Navigator.push(context, route)
// Navigator.push(context,
// ApplicationRouterSlide(widget: LessGroupPage()));
},
color: Colors.cyan,
splashColor: Colors.green,
elevation: 10,
child: Text(
item['title'],
style: TextStyle(color: Colors.white),
),
),
)
.toList(),
),
),
),
),
);
}
}
以上就是 视频直播系统源码,平台在日间和夜间模式之间来回切换实现的相关代码,更多内容欢迎关注之后的文章
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。