Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

v1.0.1 #44

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
ckken merged 10 commits into master from dev
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat:优化tab‘
  • Loading branch information
wanwusangzhi committed Mar 19, 2019
commit 0e53181d7e6c5afa91fb60a9cb2012ba01a7e7d2
1 change: 0 additions & 1 deletion lib/page/component/tabs.dart
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:efox_flutter/config/theme.dart' show AppTheme;
import 'package:efox_flutter/widget/index.dart' as WidgetRoot;
import 'package:efox_flutter/router/index.dart' show FluroRouter;
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
import 'package:efox_flutter/components/headerComp.dart' as Header;

class Index extends StatefulWidget {
final MainStateModel model;
Expand Down
3 changes: 2 additions & 1 deletion lib/page/home.dart
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import 'package:efox_flutter/store/index.dart' show Store;
import 'package:efox_flutter/controller/index.dart' as Controller;

//import 'component/index.dart' as TabIndex;
// import 'mine/index.dart' as MyIndex;
import 'component/tabs.dart' as TabIndex;
import 'mine/index.dart' as MyIndex;
import 'mine/index_1.dart' as MyIndex;

class Index extends StatefulWidget {
@override
Expand Down
206 changes: 206 additions & 0 deletions lib/page/mine/index_1.dart
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import 'package:flutter/material.dart';
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
import 'package:efox_flutter/router/index.dart' show FluroRouter;
import 'package:efox_flutter/config/theme.dart' show AppTheme;

class _IndexState extends State<Index> {
@override
void initState() {
super.initState();
}

List<dynamic> _getList() {
return [
{
'name': AppLocalizations.$t('common_mine_1.language'),
'icon': 59540, // language
'index': 0
},
{
'name': AppLocalizations.$t('common_mine_1.environment'),
'icon': 57539, // import_export
'index': 1,
},
{
'name': AppLocalizations.$t('common_mine_1.compProgress'),
'icon': 57709, // low_priority
'index': 2
}
];
}

actionsEvent(int index) {
print('index $index');
switch (index) {
case 0:
this.openLanguageSelectMenu();
break;
case 1:
this.openEnvSelectMenu();
break;
case 2:
FluroRouter.router.navigateTo(
context,
'/webview?url=${Uri.encodeComponent(widget.model.config.state.env.githubWeb)}&title=${Uri.encodeComponent(AppLocalizations.$t('common.compProgress'))}',
);
break;
}
}

void pop([message]) {
Navigator.pop(context);
if (message != null) {
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text(message),
));
}
}

/**
* 国际化
*/
void openLanguageSelectMenu() async {
await showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return Container(
child: Wrap(
children: <Widget>[
ListTile(
leading: Icon(Icons.label_outline),
title: Text(
AppLocalizations.$t('common_mine_1.cn'),
),
onTap: () {
AppLocalizations.changeLanguage(Locale('zh'));
this.pop(AppLocalizations.$t('common_mine_1.success'));
},
),
ListTile(
leading: Icon(Icons.label_outline),
title: Text(AppLocalizations.$t('common_mine_1.en')),
onTap: () {
AppLocalizations.changeLanguage(Locale('en'));
this.pop(AppLocalizations.$t('common_mine_1.success'));
},
),
],
),
);
},
);
}

/**
* 环境选择
*/
void openEnvSelectMenu() async {
await showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return Container(
child: Wrap(
children: <Widget>[
ListTile(
leading: Icon(Icons.label_outline),
title: Text(
AppLocalizations.$t('mine.loadNetwork'),
),
onTap: () {
widget.model.dispatch('config', 'setEnv', true);
this.pop(AppLocalizations.$t('common_mine_1.success'));
},
),
ListTile(
leading: Icon(Icons.label_outline),
title: Text(AppLocalizations.$t('mine.loadLocal')),
onTap: () {
widget.model.dispatch('config', 'setEnv', false);
this.pop(AppLocalizations.$t('common_mine_1.success'));
},
),
],
),
);
},
);
}

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10)
),
color: Colors.red,
),
height: 240,
child: Stack(
alignment: const FractionalOffset(0.8, 0.8),
children: <Widget>[
Row(
children: <Widget>[
Image.network(
'https://raw.githubusercontent.com/efoxTeam/flutter-ui/master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png',
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
Text(
'Hello Guest',
style: TextStyle(color: Colors.white),
)
],
)
],
),
),
ListView.builder(
shrinkWrap: true,
itemCount: _getList().length * 2,
itemBuilder: (context, index) {
double _index = index / 2;
if (index % 2 == 0) {
dynamic item = _getList()[_index.toInt()];
return ListTile(
onTap: () {
actionsEvent(item['index']);
},
leading: Icon(
IconData(
item['icon'],
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
),
title: Text(item['name']),
);
} else {
return Divider(
color: Color(AppTheme.lineColor),
);
}
},
),
],
),
);
}
}

class Index extends StatefulWidget {
final dynamic model;

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

@override
_IndexState createState() => _IndexState();
}
2 changes: 1 addition & 1 deletion lib/store/models/config_state_model.dart
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ConfigModel {

switch (name) {
case 'setEnv':
_appConfigInfo.isPro = !_appConfigInfo.isPro;
_appConfigInfo.isPro = payload;
break;
case 'setVersion':
_appConfigInfo.version = await this.getVersion();
Expand Down
8 changes: 8 additions & 0 deletions locale/en.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"changeVersion": "checkVersion",
"compProgress": "Components Progress"
},
"common_mine_1" : {
"cn": "CN",
"en": "EN",
"language": "Select Language",
"environment": "Select Environment",
"compProgress": "Components Progress",
"success": "Success To Change "
},
"mine": {
"loadNetwork": "Load Network Document Resources",
"loadLocal": "Load Local Document Resources"
Expand Down
12 changes: 10 additions & 2 deletions locale/zh.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@
"changeVersion": "更新版本",
"compProgress": "组件进度"
},
"common_mine_1" : {
"cn": "CN",
"en": "EN",
"language": "选择语言",
"environment": "选择环境",
"compProgress": "组件进度",
"success": "切换成功"
},
"mine": {
"loadNetwork": "加载网络文档资源",
"loadLocal": "加载本地文档资源"
"loadNetwork": "网络优良,可选择加载线上文档资源",
"loadLocal": "网络较差时,可选择加载本地文档资源"
},
"loading": "加载中"
}

AltStyle によって変換されたページ (->オリジナル) /