成品直播源码,Flutter 夜间模式 全局字体
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 = [
},
];
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(),
),
),
),
),
);
}
}
以上就是成品直播源码,Flutter 夜间模式 全局字体, 更多内容欢迎关注之后的文章
标签:widget,flutter,Flutter,Colors,直播,context,Navigator,源码 From: https://www.cnblogs.com/yunbaomengnan/p/17175470.html