Skip to content

Commit 61f0575

Browse files
authored
Merge pull request #11 from efoxTeam/dev-ken
Dev ken
2 parents cf76656 + 85c8f5f commit 61f0575

File tree

9 files changed

+65
-42
lines changed

9 files changed

+65
-42
lines changed

git.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# git使用规范
2+
## 提交规范
3+
+ feat:新功能(feature)
4+
+ fix:修补bug
5+
+ docs:文档(documentation)
6+
+ style: 格式(不影响代码运行的变动)
7+
+ refactor:重构(即不是新增功能,也不是修改bug的代码变动)
8+
+ test:增加测试
9+
+ chore:构建过程或辅助工具的变动

lib/components/exampleComp.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import 'package:flutter/material.dart';
2-
import 'package:efox_flutter/store/models/main_state_model.dart' show MainStateModel;
2+
import 'package:efox_flutter/store/models/main_state_model.dart'
3+
show MainStateModel;
34
import 'package:efox_flutter/store/store.dart' show Store;
5+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
46

57
class Index extends StatelessWidget {
68
final Widget child;
79

8-
Index({Key key, this.child}):super(key: key);
10+
Index({Key key, this.child}) : super(key: key);
911

1012
@override
1113
Widget build(BuildContext context) {
@@ -15,14 +17,11 @@ class Index extends StatelessWidget {
1517
height: 420.0,
1618
margin: EdgeInsets.fromLTRB(50, 40, 50, 40),
1719
decoration: BoxDecoration(
18-
border: Border.all(
19-
color: Color(model.theme.mainColor),
20-
width: 1.0
21-
),
20+
border: Border.all(color: Color(AppTheme.mainColor), width: 1.0),
2221
),
2322
child: this.child,
2423
);
2524
},
2625
);
2726
}
28-
}
27+
}

lib/components/widgetComp.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:efox_flutter/components/exampleComp.dart' as ExampleComp;
88
import 'package:efox_flutter/utils/file.dart' as FileUtils;
99
import 'package:efox_flutter/utils/loadAsset.dart' as LoadAssetUtils;
1010
import 'package:efox_flutter/router/index.dart' show FluroRouter;
11+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
1112

1213
class Index extends StatefulWidget {
1314
final List<Widget> demoChild;
@@ -149,7 +150,7 @@ class IndexState extends State<Index> {
149150
child: Row(children: [
150151
Icon(
151152
Icons.home,
152-
color: Color(model.theme.greyColor),
153+
color: Color(AppTheme.greyColor),
153154
),
154155
Text(" "),
155156
Text('Flutter-UI'),
@@ -160,7 +161,7 @@ class IndexState extends State<Index> {
160161
child: Row(children: [
161162
Icon(
162163
Icons.code,
163-
color: Color(model.theme.greyColor),
164+
color: Color(AppTheme.greyColor),
164165
),
165166
Text(" "),
166167
Text(this.title),
@@ -205,8 +206,7 @@ class IndexState extends State<Index> {
205206
child: Text(
206207
AppTranslations.of(context).t('loading'),
207208
style: TextStyle(
208-
color: Color(this.model.theme.secondColor),
209-
fontSize: 20.0),
209+
color: Color(AppTheme.secondColor), fontSize: 20.0),
210210
),
211211
)
212212
],

lib/config/theme.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import 'package:flutter/material.dart';
2+
3+
class AppTheme {
4+
static int mainColor = 0xFFD32F2F;
5+
static int secondColor = 0xFFFFFFFF;
6+
static int thirdColor = 0xFFFAFAFA;
7+
static int greyColor = 0x8A000000;
8+
static int blackColor = 0xFF000000;
9+
static ThemeData themData = ThemeData(
10+
textTheme: TextTheme(
11+
body1: TextStyle(
12+
// color: Colors.black,
13+
// fontWeight: FontWeight.bold,
14+
),
15+
),
16+
platform: TargetPlatform.iOS,
17+
iconTheme: IconThemeData(
18+
size: 32,
19+
color: Color(thirdColor),
20+
opacity: 0.85,
21+
),
22+
// primaryIconTheme 导航栏按钮颜色
23+
primaryIconTheme: IconThemeData(
24+
color: Color(secondColor),
25+
),
26+
accentColor: Colors.grey, // 选中颜色
27+
primaryColor: Color(mainColor), // appbar背景
28+
scaffoldBackgroundColor: Color(thirdColor), // 整体的scaffold背景颜色
29+
);
30+
}

lib/main.dart

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import 'package:efox_flutter/lang/app_translations_delegate.dart';
77
import 'package:efox_flutter/store/store.dart' show model, Store;
88
//路由
99
import 'package:efox_flutter/router/index.dart';
10+
//主题
11+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
12+
1013
void main() => runApp(MainApp());
1114

1215
class MainApp extends StatefulWidget {
@@ -56,27 +59,7 @@ class MainAppState extends State<MainApp> {
5659
const Locale('zh'),
5760
],
5861
title: 'Flutter Demo',
59-
theme: ThemeData(
60-
textTheme: TextTheme(
61-
body1: TextStyle(
62-
// color: Colors.black,
63-
// fontWeight: FontWeight.bold,
64-
),
65-
),
66-
platform: TargetPlatform.iOS,
67-
iconTheme: IconThemeData(
68-
size: 32,
69-
color: Color(model.theme.thirdColor),
70-
opacity: 0.85,
71-
),
72-
// primaryIconTheme 导航栏按钮颜色
73-
primaryIconTheme: IconThemeData(
74-
color: Color(model.theme.secondColor),
75-
),
76-
accentColor: Colors.grey, // 选中颜色
77-
primaryColor: Color(model.theme.mainColor), // appbar背景
78-
scaffoldBackgroundColor: Color(model.theme.thirdColor), // 整体的scaffold背景颜色
79-
),
62+
theme: AppTheme.themData,
8063
onGenerateRoute: FluroRouter.router.generator,
8164
),
8265
);

lib/page/component/index.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:efox_flutter/router/index.dart';
33
import 'package:efox_flutter/store/models/main_state_model.dart';
44
import 'package:efox_flutter/widget/index.dart' as WidgetRoot;
5+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
56

67
class Index extends StatefulWidget {
78
final MainStateModel model;
@@ -43,7 +44,7 @@ class _IndexState extends State<Index> {
4344
fontFamily: 'MaterialIcons',
4445
matchTextDirection: true,
4546
),
46-
// color: Color(model.theme.mainColor),
47+
// color: Color(AppTheme.mainColor),
4748
),
4849
backgroundColor: Colors.white,
4950
children: [
@@ -74,7 +75,7 @@ class _IndexState extends State<Index> {
7475
fontFamily: 'MaterialIcons',
7576
matchTextDirection: true,
7677
),
77-
color: Color(model.theme.mainColor),
78+
color: Color(AppTheme.mainColor),
7879
),
7980
onPressed: () {
8081
FluroRouter.router.navigateTo(

lib/page/home.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:efox_flutter/store/store.dart' show Store, MainStateModel;
88
import 'package:efox_flutter/components/header.dart' as Header;
99
import 'component/index.dart' as TabIndex;
1010
import 'mine/index.dart' as MyIndex;
11+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
1112

1213
class Index extends StatefulWidget {
1314
@override
@@ -26,7 +27,7 @@ class _IndexState extends State<Index> with SingleTickerProviderStateMixin {
2627
border: Border(
2728
top: BorderSide(
2829
width: .1,
29-
color: Color(model.theme.greyColor),
30+
color: Color(AppTheme.greyColor),
3031
),
3132
),
3233
),
@@ -35,14 +36,14 @@ class _IndexState extends State<Index> with SingleTickerProviderStateMixin {
3536
border: Border(
3637
bottom: BorderSide(
3738
width: .2,
38-
color: Color(model.theme.mainColor),
39+
color: Color(AppTheme.mainColor),
3940
),
4041
),
4142
),
42-
labelColor: Color(model.theme.mainColor),
43-
unselectedLabelColor: Color(model.theme.greyColor),
43+
labelColor: Color(AppTheme.mainColor),
44+
unselectedLabelColor: Color(AppTheme.greyColor),
4445
indicatorSize: TabBarIndicatorSize.tab,
45-
indicatorColor: Color(model.theme.secondColor),
46+
indicatorColor: Color(AppTheme.secondColor),
4647
labelStyle: TextStyle(
4748
color: Colors.green,
4849
fontWeight: FontWeight.w700,
@@ -73,7 +74,7 @@ class _IndexState extends State<Index> with SingleTickerProviderStateMixin {
7374
PopupMenuButton(
7475
icon: Icon(
7576
Icons.more_vert,
76-
// color: Color(model.theme.textColor),
77+
// color: Color(AppTheme.textColor),
7778
),
7879
onSelected: (local) {
7980
Application().onLocaleChanged(Locale(local));

locale/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"title": "efox flutter tech app",
2+
"title": "Components",
33
"title_component": "Components",
44
"title_my": "My",
55
"widgetType": {

locale/zh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"title": "efox flutter教学应用",
2+
"title": "组件",
33
"title_component": "组件",
44
"title_my": "我的",
55
"widgetType": {

0 commit comments

Comments
 (0)