Skip to content

Dev ken #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# git使用规范
## 提交规范
+ feat:新功能(feature)
+ fix:修补bug
+ docs:文档(documentation)
+ style: 格式(不影响代码运行的变动)
+ refactor:重构(即不是新增功能,也不是修改bug的代码变动)
+ test:增加测试
+ chore:构建过程或辅助工具的变动
13 changes: 6 additions & 7 deletions lib/components/exampleComp.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import 'package:efox_flutter/store/models/main_state_model.dart' show MainStateModel;
import 'package:efox_flutter/store/models/main_state_model.dart'
show MainStateModel;
import 'package:efox_flutter/store/store.dart' show Store;
import 'package:efox_flutter/config/theme.dart' show AppTheme;

class Index extends StatelessWidget {
final Widget child;

Index({Key key, this.child}):super(key: key);
Index({Key key, this.child}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -15,14 +17,11 @@ class Index extends StatelessWidget {
height: 420.0,
margin: EdgeInsets.fromLTRB(50, 40, 50, 40),
decoration: BoxDecoration(
border: Border.all(
color: Color(model.theme.mainColor),
width: 1.0
),
border: Border.all(color: Color(AppTheme.mainColor), width: 1.0),
),
child: this.child,
);
},
);
}
}
}
8 changes: 4 additions & 4 deletions lib/components/widgetComp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:efox_flutter/components/exampleComp.dart' as ExampleComp;
import 'package:efox_flutter/utils/file.dart' as FileUtils;
import 'package:efox_flutter/utils/loadAsset.dart' as LoadAssetUtils;
import 'package:efox_flutter/router/index.dart' show FluroRouter;
import 'package:efox_flutter/config/theme.dart' show AppTheme;

class Index extends StatefulWidget {
final List<Widget> demoChild;
Expand Down Expand Up @@ -149,7 +150,7 @@ class IndexState extends State<Index> {
child: Row(children: [
Icon(
Icons.home,
color: Color(model.theme.greyColor),
color: Color(AppTheme.greyColor),
),
Text(" "),
Text('Flutter-UI'),
Expand All @@ -160,7 +161,7 @@ class IndexState extends State<Index> {
child: Row(children: [
Icon(
Icons.code,
color: Color(model.theme.greyColor),
color: Color(AppTheme.greyColor),
),
Text(" "),
Text(this.title),
Expand Down Expand Up @@ -205,8 +206,7 @@ class IndexState extends State<Index> {
child: Text(
AppTranslations.of(context).t('loading'),
style: TextStyle(
color: Color(this.model.theme.secondColor),
fontSize: 20.0),
color: Color(AppTheme.secondColor), fontSize: 20.0),
),
)
],
Expand Down
30 changes: 30 additions & 0 deletions lib/config/theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';

class AppTheme {
static int mainColor = 0xFFD32F2F;
static int secondColor = 0xFFFFFFFF;
static int thirdColor = 0xFFFAFAFA;
static int greyColor = 0x8A000000;
static int blackColor = 0xFF000000;
static ThemeData themData = ThemeData(
textTheme: TextTheme(
body1: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.bold,
),
),
platform: TargetPlatform.iOS,
iconTheme: IconThemeData(
size: 32,
color: Color(thirdColor),
opacity: 0.85,
),
// primaryIconTheme 导航栏按钮颜色
primaryIconTheme: IconThemeData(
color: Color(secondColor),
),
accentColor: Colors.grey, // 选中颜色
primaryColor: Color(mainColor), // appbar背景
scaffoldBackgroundColor: Color(thirdColor), // 整体的scaffold背景颜色
);
}
25 changes: 4 additions & 21 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import 'package:efox_flutter/lang/app_translations_delegate.dart';
import 'package:efox_flutter/store/store.dart' show model, Store;
//路由
import 'package:efox_flutter/router/index.dart';
//主题
import 'package:efox_flutter/config/theme.dart' show AppTheme;

void main() => runApp(MainApp());

class MainApp extends StatefulWidget {
Expand Down Expand Up @@ -56,27 +59,7 @@ class MainAppState extends State<MainApp> {
const Locale('zh'),
],
title: 'Flutter Demo',
theme: ThemeData(
textTheme: TextTheme(
body1: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.bold,
),
),
platform: TargetPlatform.iOS,
iconTheme: IconThemeData(
size: 32,
color: Color(model.theme.thirdColor),
opacity: 0.85,
),
// primaryIconTheme 导航栏按钮颜色
primaryIconTheme: IconThemeData(
color: Color(model.theme.secondColor),
),
accentColor: Colors.grey, // 选中颜色
primaryColor: Color(model.theme.mainColor), // appbar背景
scaffoldBackgroundColor: Color(model.theme.thirdColor), // 整体的scaffold背景颜色
),
theme: AppTheme.themData,
onGenerateRoute: FluroRouter.router.generator,
),
);
Expand Down
5 changes: 3 additions & 2 deletions lib/page/component/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:efox_flutter/router/index.dart';
import 'package:efox_flutter/store/models/main_state_model.dart';
import 'package:efox_flutter/widget/index.dart' as WidgetRoot;
import 'package:efox_flutter/config/theme.dart' show AppTheme;

class Index extends StatefulWidget {
final MainStateModel model;
Expand Down Expand Up @@ -43,7 +44,7 @@ class _IndexState extends State<Index> {
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
// color: Color(model.theme.mainColor),
// color: Color(AppTheme.mainColor),
),
backgroundColor: Colors.white,
children: [
Expand Down Expand Up @@ -74,7 +75,7 @@ class _IndexState extends State<Index> {
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
color: Color(model.theme.mainColor),
color: Color(AppTheme.mainColor),
),
onPressed: () {
FluroRouter.router.navigateTo(
Expand Down
13 changes: 7 additions & 6 deletions lib/page/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:efox_flutter/store/store.dart' show Store, MainStateModel;
import 'package:efox_flutter/components/header.dart' as Header;
import 'component/index.dart' as TabIndex;
import 'mine/index.dart' as MyIndex;
import 'package:efox_flutter/config/theme.dart' show AppTheme;

class Index extends StatefulWidget {
@override
Expand All @@ -26,7 +27,7 @@ class _IndexState extends State<Index> with SingleTickerProviderStateMixin {
border: Border(
top: BorderSide(
width: .1,
color: Color(model.theme.greyColor),
color: Color(AppTheme.greyColor),
),
),
),
Expand All @@ -35,14 +36,14 @@ class _IndexState extends State<Index> with SingleTickerProviderStateMixin {
border: Border(
bottom: BorderSide(
width: .2,
color: Color(model.theme.mainColor),
color: Color(AppTheme.mainColor),
),
),
),
labelColor: Color(model.theme.mainColor),
unselectedLabelColor: Color(model.theme.greyColor),
labelColor: Color(AppTheme.mainColor),
unselectedLabelColor: Color(AppTheme.greyColor),
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: Color(model.theme.secondColor),
indicatorColor: Color(AppTheme.secondColor),
labelStyle: TextStyle(
color: Colors.green,
fontWeight: FontWeight.w700,
Expand Down Expand Up @@ -73,7 +74,7 @@ class _IndexState extends State<Index> with SingleTickerProviderStateMixin {
PopupMenuButton(
icon: Icon(
Icons.more_vert,
// color: Color(model.theme.textColor),
// color: Color(AppTheme.textColor),
),
onSelected: (local) {
Application().onLocaleChanged(Locale(local));
Expand Down
2 changes: 1 addition & 1 deletion locale/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"title": "efox flutter tech app",
"title": "Components",
"title_component": "Components",
"title_my": "My",
"widgetType": {
Expand Down
2 changes: 1 addition & 1 deletion locale/zh.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"title": "efox flutter教学应用",
"title": "组件",
"title_component": "组件",
"title_my": "我的",
"widgetType": {
Expand Down