视频直播系统源码,平台在日间和夜间模式之间来回切换
视频直播系统源码,平台在日间和夜间模式之间来回切换实现的相关代码
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(),
),
),
),
),
);
}
}
以上就是 视频直播系统源码,平台在日间和夜间模式之间来回切换实现的相关代码,更多内容欢迎关注之后的文章