Skip to content

Commit

Permalink
up 资源name
Browse files Browse the repository at this point in the history
  • Loading branch information
thl committed Jan 30, 2019
1 parent 693772b commit f4fa4c0
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 37 deletions.
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Flutter版 WanAndroid App.


## 项目已全部开源。欢迎Star&Fork。
本项目包含启动页,引导页,主题色,国际化,Bloc,RxDart。拥有较好的项目结构,比较规范的代码。 App拥有精致的UI界面,统一的交互,侧滑退出,列表和Web界面均提供快速滚动至顶部功能。
有关项目最新动态,可以关注App内第一条Hot Item信息。

[更新说明](./CHANGELOG.md)

### 有关项目最新动态,可以关注App内第一条Hot Item信息。

### 温馨提示,请保持App更新至最新版本~
PS:未来可以第一时间下载体验作者其他NB项目的App。

### 运行本项目注意!!!
由于在国内访问Flutter有时可能会受到限制,clone项目后,请勿直接packages get,建议运行如下目录行:
```
Expand Down Expand Up @@ -36,7 +39,7 @@ flutter packages get
> - |-- db (数据库)
> - |-- event (事件类)
> - |-- models (实体类)
> - |-- resources (资源文件,string,colors,dimens,styles)
> - |-- res (资源文件,string,colors,dimens,styles)
> - |-- ui (界面相关page,dialog,widgets)
> - |-- utils (工具类)
## data网络数据层
Expand Down Expand Up @@ -114,16 +117,16 @@ class LoginReq {
}
```

## 资源文件 resources
>- |--resources
## 资源文件 res
>- |--res
> - |-- colors.dart
> - |-- dimens.dart
> - |-- strings.dart
> - |-- styles.dart
### colors.dart
```
class ColorT {
class Colours {
static const Color app_main = Color(0xFF666666);
static const Color text_dark = Color(0xFF333333);
Expand Down Expand Up @@ -171,18 +174,27 @@ Map<String, Map<String, Map<String, String>>> localizedValues = {
class TextStyles {
static TextStyle listTitle = TextStyle(
fontSize: Dimens.font_sp16,
color: ColorT.text_dark,
color: Colours.text_dark,
fontWeight: FontWeight.bold,
);
static TextStyle listContent = TextStyle(
fontSize: Dimens.font_sp14,
color: ColorT.text_normal,
color: Colours.text_normal,
);
static TextStyle listExtra = TextStyle(
fontSize: Dimens.font_sp12,
color: ColorT.text_gray,
color: Colours.text_gray,
);
}
// 间隔
class Gaps {
// 水平间隔
static Widget hGap5 = new SizedBox(width: Dimens.gap_dp5);
static Widget hGap10 = new SizedBox(width: Dimens.gap_dp10);
// 垂直间隔
static Widget vGap5 = new SizedBox(height: Dimens.gap_dp5);
static Widget vGap10 = new SizedBox(height: Dimens.gap_dp10);
}
```
### Flutter 国际化相关
[fluintl](https://github.com/Sky24n/fluintl) 是一个为应用提供国际化的库,可快速集成实现应用多语言。该库封装了一个国际化支持类,通过提供统一方法getString(id)获取字符串。
Expand All @@ -204,7 +216,7 @@ IntlUtil.getString(context, Ids.titleHome);
CustomLocalizations.of(context).getString(StringIds.titleHome);
```

### Flutter 屏幕适配 [ScreenUtil](https://github.com/Sky24n/flustars)
### Flutter 屏幕适配 [ScreenUtil](https://github.com/Sky24n/flustars)
方案一、不依赖context
```
步骤 1
Expand Down
2 changes: 1 addition & 1 deletion lib/common/component_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export 'dart:convert';

export 'package:flutter_wanandroid/blocs/bloc_index.dart';
export 'package:flutter_wanandroid/ui/widgets/widget_index.dart';
export 'package:flutter_wanandroid/resources/res_index.dart';
export 'package:flutter_wanandroid/res/res_index.dart';
export 'package:flutter_wanandroid/utils/util_index.dart';

export 'package:flutter_wanandroid/common/common.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MyApp extends StatefulWidget {

class MyAppState extends State<MyApp> {
Locale _locale;
Color _themeColor = ColorT.app_main;
Color _themeColor = Colours.app_main;

@override
void initState() {
Expand Down
4 changes: 2 additions & 2 deletions lib/resources/colors.dart → lib/res/colors.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';

class ColorT {
class Colours {
static const Color app_main = Color(0xFF666666);

static const Color transparent_80 = Color(0x80000000); //<!--204-->
Expand Down Expand Up @@ -58,7 +58,7 @@ Map<String, Color> circleAvatarMap = {
};

Map<String, Color> themeColorMap = {
'gray': ColorT.gray_33,
'gray': Colours.gray_33,
'blue': Colors.blue,
'blueAccent': Colors.blueAccent,
'cyan': Colors.cyan,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 8 additions & 6 deletions lib/resources/styles.dart → lib/res/styles.dart
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_wanandroid/resources/res_index.dart';
import 'package:flutter_wanandroid/res/res_index.dart';

class TextStyles {
static TextStyle listTitle = TextStyle(
fontSize: Dimens.font_sp16,
color: ColorT.text_dark,
color: Colours.text_dark,
fontWeight: FontWeight.bold,
);
static TextStyle listContent = TextStyle(
fontSize: Dimens.font_sp14,
color: ColorT.text_normal,
color: Colours.text_normal,
);
static TextStyle listExtra = TextStyle(
fontSize: Dimens.font_sp12,
color: ColorT.text_gray,
color: Colours.text_gray,
);
}

class Decorations {
static Decoration bottom = BoxDecoration(
border: Border(bottom: BorderSide(width: 0.33, color: ColorT.divider)));
border: Border(bottom: BorderSide(width: 0.33, color: Colours.divider)));
}

/// 间隔
class Gaps {
/// 水平间隔
static Widget hGap5 = new SizedBox(width: Dimens.gap_dp5);
static Widget hGap10 = new SizedBox(width: Dimens.gap_dp10);
static Widget hGap15 = new SizedBox(width: Dimens.gap_dp15);

/// 垂直间隔
static Widget vGap5 = new SizedBox(height: Dimens.gap_dp5);
static Widget vGap10 = new SizedBox(height: Dimens.gap_dp10);
static Widget vGap15 = new SizedBox(height: Dimens.gap_dp15);
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/pages/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class AboutPage extends StatelessWidget {
Gaps.vGap5,
new Text(
'版本号 ' + AppConfig.version,
style: new TextStyle(color: ColorT.gray_99, fontSize: 14.0),
style: new TextStyle(color: Colours.gray_99, fontSize: 14.0),
)
],
),
decoration: new BoxDecoration(
color: Colors.white,
border: new Border.all(width: 0.33, color: ColorT.divider))),
border: new Border.all(width: 0.33, color: Colours.divider))),
new ComArrowItem(github),
new ComArrowItem(author),
new StreamBuilder(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/pages/rec_hot_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class RecHotPage extends StatelessWidget {
decoration: new BoxDecoration(
color: Colors.white,
border: new Border.all(
width: 0.33, color: ColorT.divider))),
width: 0.33, color: Colours.divider))),
);
},
);
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/pages/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SettingPage extends StatelessWidget {
children: <Widget>[
Icon(
Icons.color_lens,
color: ColorT.gray_66,
color: Colours.gray_66,
),
Padding(
padding: EdgeInsets.only(left: 10.0),
Expand Down Expand Up @@ -56,7 +56,7 @@ class SettingPage extends StatelessWidget {
children: <Widget>[
Icon(
Icons.language,
color: ColorT.gray_66,
color: Colours.gray_66,
),
Padding(
padding: EdgeInsets.only(left: 10.0),
Expand All @@ -77,7 +77,7 @@ class SettingPage extends StatelessWidget {
languageCode: 'zh', countryCode: 'CH'),
style: TextStyle(
fontSize: 14.0,
color: ColorT.gray_99,
color: Colours.gray_99,
)),
Icon(Icons.keyboard_arrow_right)
],
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/pages/splash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class SplashPageState extends State<SplashPage> {
color: Color(0x66000000),
borderRadius: BorderRadius.all(Radius.circular(4.0)),
border: new Border.all(
width: 0.33, color: ColorT.divider))),
width: 0.33, color: Colours.divider))),
),
),
)
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/article_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ArticleItem extends StatelessWidget {
),
decoration: new BoxDecoration(
color: Colors.white,
border: new Border.all(width: 0.33, color: ColorT.divider))),
border: new Border.all(width: 0.33, color: Colours.divider))),
);
}
}
4 changes: 2 additions & 2 deletions lib/ui/widgets/header_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class HeaderItem extends StatelessWidget {
],
)),
decoration: new BoxDecoration(
//new Border.all(width: 0.33, color: ColorT.divider)
//new Border.all(width: 0.33, color: Colours.divider)
border: new Border(
bottom: new BorderSide(width: 0.33, color: ColorT.divider))),
bottom: new BorderSide(width: 0.33, color: Colours.divider))),
);
}
}
2 changes: 1 addition & 1 deletion lib/ui/widgets/refresh_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class RefreshScaffoldState extends State<RefreshScaffold>
offstage: widget.isLoading != true,
child: new Container(
alignment: Alignment.center,
color: ColorT.gray_f0,
color: Colours.gray_f0,
child: new ProgressView(),
),
)
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/repos_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ReposItem extends StatelessWidget {
decoration: new BoxDecoration(
color: Colors.white,
border: new Border(
bottom: new BorderSide(width: 0.33, color: ColorT.divider)))),
bottom: new BorderSide(width: 0.33, color: Colours.divider)))),
);
}
}
2 changes: 1 addition & 1 deletion lib/ui/widgets/tree_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _ChipsTile extends StatelessWidget {
decoration: new BoxDecoration(
color: Colors.white,
border: new Border(
bottom: new BorderSide(width: 0.33, color: ColorT.divider))),
bottom: new BorderSide(width: 0.33, color: Colours.divider))),
);
}
}
6 changes: 3 additions & 3 deletions lib/ui/widgets/web_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class WebScaffoldState extends State<WebScaffold> {
children: <Widget>[
Icon(
Icons.language,
color: ColorT.gray_66,
color: Colours.gray_66,
size: 22.0,
),
Gaps.hGap10,
Expand All @@ -93,7 +93,7 @@ class WebScaffoldState extends State<WebScaffold> {
// children: <Widget>[
// Icon(
// Icons.collections,
// color: ColorT.gray_66,
// color: Colours.gray_66,
// size: 22.0,
// ),
// Gaps.hGap10,
Expand All @@ -115,7 +115,7 @@ class WebScaffoldState extends State<WebScaffold> {
children: <Widget>[
Icon(
Icons.share,
color: ColorT.gray_66,
color: Colours.gray_66,
size: 22.0,
),
Gaps.hGap10,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_wanandroid/common/common.dart';
import 'package:flutter_wanandroid/resources/res_index.dart';
import 'package:flutter_wanandroid/res/res_index.dart';
import 'package:lpinyin/lpinyin.dart';

class Utils {
Expand Down

0 comments on commit f4fa4c0

Please sign in to comment.