Skip to content

Commit

Permalink
up readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thl committed Mar 26, 2019
1 parent 48e7d63 commit b42a43a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ flutter packages get
> - |-- repository (接口请求&解析)
### api
```
```dart
class WanAndroidApi {
/// 首页banner http://www.wanandroid.com/banner/json
static const String BANNER = "banner";
Expand All @@ -90,7 +90,7 @@ class WanAndroidApi {
}
```
### 网络请求工具类 单例DioUtil
```
```dart
// 打开debug模式.
DioUtil.openDebug();
Expand All @@ -117,7 +117,7 @@ DioUtil().requestR(Method.post, "user/login",data: rformData);
```
### 请求与返回实体类 protocol
```
```dart
class LoginReq {
String username;
String password;
Expand All @@ -144,7 +144,7 @@ class LoginReq {
}
```
### 接口请求&解析 repository
```
```dart
class WanRepository {
Future<List<BannerModel>> getBanner() async {
BaseResp<List> baseResp = await DioUtil().request<List>(
Expand All @@ -171,7 +171,7 @@ class LoginReq {
> - |-- styles.dart
### colors.dart
```
```dart
class Colours {
static const Color app_main = Color(0xFF666666);
Expand All @@ -181,7 +181,7 @@ class Colours {
}
```
### dimens.dart
```
```dart
class Dimens {
static const double font_sp12 = 12;
static const double font_sp14 = 14;
Expand All @@ -192,7 +192,7 @@ class Dimens {
}
```
### strings.dart
```
```dart
class Ids {
static const String titleHome = 'title_home';
}
Expand All @@ -216,7 +216,7 @@ Map<String, Map<String, Map<String, String>>> localizedValues = {
};
```
### styles.dart
```
```dart
class TextStyles {
static TextStyle listTitle = TextStyle(
fontSize: Dimens.font_sp16,
Expand Down Expand Up @@ -244,7 +244,7 @@ class Gaps {
```
### Flutter 国际化相关
[fluintl](https://github.com/Sky24n/fluintl) 是一个为应用提供国际化的库,可快速集成实现应用多语言。该库封装了一个国际化支持类,通过提供统一方法getString(id)获取字符串。
```
```dart
// 在MyApp initState配置多语言资源
setLocalizedValues(localizedValues); //配置多语言资源
// 在MaterialApp指定localizationsDelegates和supportedLocales
Expand All @@ -264,12 +264,12 @@ CustomLocalizations.of(context).getString(StringIds.titleHome);

### Flutter 屏幕适配 [ScreenUtil](https://github.com/Sky24n/flustars)
方案一、不依赖context
```
步骤 1
//如果设计稿尺寸默认配置一致,无需该设置。 配置设计稿尺寸 默认 360.0 / 640.0 / 3.0
```dart
// 步骤1
// 如果设计稿尺寸默认配置一致,无需该设置。 配置设计稿尺寸 默认 360.0 / 640.0 / 3.0
setDesignWHD(_designW,_designH,_designD);
步骤 2
// 步骤2
// 在MainPageState build 调用MediaQuery.of(context)
class MainPageState extends State<MainPage> {
@override
Expand All @@ -282,7 +282,7 @@ class MainPageState extends State<MainPage> {
}
}
步骤 3
// 步骤3
ScreenUtil.getInstance().screenWidth
ScreenUtil.getInstance().screenHeight
//屏幕适配相关
Expand All @@ -294,7 +294,7 @@ ScreenUtil.getInstance().getSp(fontSize); //返回根据屏幕宽适配后字体
```
方案二、依赖context
```
```dart
//如果设计稿尺寸默认配置一致,无需该设置。 配置设计稿尺寸 默认 360.0 / 640.0 / 3.0
setDesignWHD(_designW,_designH,_designD);
Expand All @@ -308,7 +308,7 @@ ScreenUtil.getScaleSp(context, size) ;//返回根据屏幕宽适配后字体尺
### Flutter 数据存储 [SpUtil](https://github.com/Sky24n/flustars)
单例"同步" SharedPreferences 工具类。
支持get获取默认参数、支持存储实体对象、支持存储实体对象数组。
```
```dart
// 等待Sp初始化完成。
await SpUtil.getInstance();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Flutter Wanandroid App.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 0.1.5+1
version: 0.1.5

environment:
sdk: ">=2.1.0 <3.0.0"
Expand Down

0 comments on commit b42a43a

Please sign in to comment.