11import 'package:flutter/material.dart' ;
22import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
3- import 'package:efox_flutter/router/index.dart' show FluroRouter;
3+ // import 'package:efox_flutter/router/index.dart' show FluroRouter;
44import 'package:efox_flutter/config/theme.dart' show AppTheme;
5+ import 'package:efox_flutter/store/index.dart' show model;
6+ import 'package:efox_flutter/config/color.dart' show materialColor;
57
68class _IndexState extends State <Index > {
79 @override
810 void initState () {
911 super .initState ();
1012 }
1113
12- void pop ([message]) {
13- Navigator .pop (context);
14- if (message != null ) {
15- Scaffold .of (context).showSnackBar (new SnackBar (
16- content: new Text (message),
17- ));
18- }
19- }
20-
2114 /**
2215 * 国际化
2316 */
@@ -29,21 +22,19 @@ class _IndexState extends State<Index> {
2922 child: Wrap (
3023 children: < Widget > [
3124 ListTile (
32- //leading: Icon(Icons.label_outline),
3325 title: Text (
34- AppLocalizations . $t ( 'common_mine_1.cn' ) ,
26+ '中文' ,
3527 ),
3628 onTap: () {
3729 AppLocalizations .changeLanguage (Locale ('zh' ));
38- this .pop (AppLocalizations . $t ( 'common_mine_1.success' ) );
30+ Navigator .pop (context );
3931 },
4032 ),
4133 ListTile (
42- //leading: Icon(Icons.label_outline),
43- title: Text (AppLocalizations .$t ('common_mine_1.en' )),
34+ title: Text ('English' ),
4435 onTap: () {
4536 AppLocalizations .changeLanguage (Locale ('en' ));
46- this .pop (AppLocalizations . $t ( 'common_mine_1.success' ) );
37+ Navigator .pop (context );
4738 },
4839 ),
4940 ],
@@ -55,6 +46,10 @@ class _IndexState extends State<Index> {
5546
5647 @override
5748 Widget build (BuildContext context) {
49+ List <Widget > _EdageList = [];
50+ materialColor.forEach ((k,v){
51+ _EdageList .add (this .Edage (k,v));
52+ });
5853 return Scaffold (
5954 appBar: AppBar (
6055 elevation: 0 ,
@@ -79,29 +74,28 @@ class _IndexState extends State<Index> {
7974 color: Color (AppTheme .lineColor),
8075 ),
8176 ExpansionTile (
77+ leading: Icon (Icons .color_lens),
8278 title: Text (AppLocalizations .$t ('common_mine_1.theme' )),
8379 children: < Widget > [
8480 Wrap (
85- //crossAxisAlignment: WrapCrossAlignment.start,
86- alignment: WrapAlignment .spaceEvenly,
87- runAlignment: WrapAlignment .spaceEvenly,
88- children: < Widget > [
89- this .Edage (AppTheme .yellow),
90- this .Edage (AppTheme .blue),
91- this .Edage (AppTheme .orange),
92- this .Edage (AppTheme .lightGreen),
93- this .Edage (AppTheme .red),
94- ],
81+ spacing: 10 ,
82+ runSpacing: 5 ,
83+ children: _EdageList ,
9584 )
9685 ],
97- )
86+ ),
87+ Divider (
88+ color: Color (AppTheme .lineColor),
89+ ),
9890 ],
9991 ));
10092 }
10193
102- Widget Edage (color) {
94+ Widget Edage (name, color) {
10395 return GestureDetector (
104- onTap: () {},
96+ onTap: () {
97+ model.dispatch ('config' , 'setTheme' , name);
98+ },
10599 child: Container (
106100 color: Color (color),
107101 height: 30 ,
0 commit comments