Skip to content

Commit

Permalink
Merge pull request #44 from efoxTeam/dev
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
ckken committed Mar 19, 2019
2 parents c72e6e8 + 95433de commit f9ccfb4
Show file tree
Hide file tree
Showing 20 changed files with 877 additions and 74 deletions.
18 changes: 11 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 27
compileSdkVersion 28

lintOptions {
disable 'InvalidPackage'
Expand All @@ -42,10 +42,10 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.flutter.beer"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
Expand Down Expand Up @@ -79,10 +79,14 @@ flutter {

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-core:16.0.8'
//Crashlytics SDK
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
}
//firebase
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
//Crashlytics SDK
apply plugin: 'io.fabric'
12 changes: 11 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@ buildscript {
repositories {
google()
jcenter()
//Crashlytics SDK
maven {
url 'https://maven.fabric.io/public'
}
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
//firebase
classpath 'com.google.gms:google-services:4.2.0'
//Crashlytics SDK
classpath 'io.fabric.tools:gradle:1.26.1'
}
}

allprojects {
repositories {
google()
jcenter()
//Crashlytics SDK
maven {
url 'https://maven.google.com/'
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
27 changes: 27 additions & 0 deletions docs/widget/navigator/pageview/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## **PageView**
> 创建一个整屏滚动的滚动列表,逐页滚动

### 构造函数
```
PageView({
Key key,
Axis scrollDirection: Axis.horizontal,
bool reverse: false,
PageController controller,
ScrollPhysics physics,
bool pageSnapping: true,
ValueChanged<int> onPageChanged,
List<Widget> children: const [],
DragStartBehavior dragStartBehavior: DragStartBehavior.down
})
```

### 属性介绍
- children:页面列表,每个子元素对应一个当前页。
- scrollDirection: Axis.horizontal/Axis.vertical, 默认是水平方向,可选择垂直方向滚动
- reverse: 滚动方向取反操作
- controller: 操作页面滚动行为类,可以通过PageController实例后的对象进行指定页面跳转,可携带特效跳转等。PageController.jumpToPage(index)
- physics: 滚动属性,可参考滚动类别中的gridview等相近属性介绍
- pageSnapping: 默认true,切换时,自动逐页跳转。当自定义滚动行为时,可设置为false,禁止页面捕获。
- onPageChanged: 页面切换时,回调函数,返回页面下标值
35 changes: 34 additions & 1 deletion docs/widget/navigator/popupmenubutton/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
## **文档完善中**
## **PopupMenuButton**

### 构造函数
```
PopupMenuButton<T>({
Key key,
@required PopupMenuItemBuilder<T> itemBuilder,
T initialValue,
PopupMenuItemSelected<T> onSelected,
PopupMenuCanceled onCanceled,
String tooltip,
double elevation: 8.0,
EdgeInsetsGeometry padding: const EdgeInsets.all(8.0),
Widget child,
Icon icon,
Offset offset: Offset.zero
})
```

### 属性介绍
- itemBuilder: (_) => { return [PopupMenuItem(), PopupMenuItem(),]}
> PopupMenuItem: 菜单子组件
```
PopupMenuItem<T>({
Key key,
T value,
bool enabled: true,
double height: _kMenuItemHeight,
@required Widget child
})
```
- onSelected: 选中后返回PopupMenuItem中value的值
- child: 有默认图标,可以修改为其它显示内容。

8 changes: 3 additions & 5 deletions lib/components/widgetComp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ class IndexState extends State<Index> {
this._bodyList.length = 0;
String mdText = await this.getMdFile(this.mdUrl);
if (mdText.length > 30 || !this.model.config.state.isPro) {
this
._bodyList
.add(await MarkDownComp.Index(mdText));
this._bodyList.add(await MarkDownComp.Index(mdText));
// demo
if (this.demoChild != null && this.demoChild.length > 0) {
this.demoChild.forEach((Widget item) {
Expand All @@ -87,9 +85,9 @@ class IndexState extends State<Index> {
this.model = model;
return Scaffold(
appBar: AppBar(
title: Header.Index(
/* title: Header.Index(
this.title,
),
), */
actions: this.getActions(
context,
),
Expand Down
5 changes: 3 additions & 2 deletions lib/config/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ class AppTheme {
static int thirdColor = 0xFFFAFAFA;
static int greyColor = 0x8A000000;
static int blackColor = 0xFF000000;
static int lineColor = 0xFFEEEEEE;
static ThemeData themData = ThemeData(
textTheme: TextTheme(
body1: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.bold,
),
),
platform: TargetPlatform.iOS,
//platform: TargetPlatform.iOS,
iconTheme: IconThemeData(
size: 32,
color: Color(thirdColor),
Expand All @@ -25,6 +26,6 @@ class AppTheme {
),
accentColor: Colors.grey, // 选中颜色
primaryColor: Color(mainColor), // appbar背景
scaffoldBackgroundColor: Color(thirdColor), // 整体的scaffold背景颜色
scaffoldBackgroundColor: Color(secondColor), // 整体的scaffold背景颜色
);
}
187 changes: 187 additions & 0 deletions lib/page/component/tabs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import 'package:flutter/material.dart';
import 'package:efox_flutter/store/models/main_state_model.dart'
show MainStateModel;
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;
Index({Key key, this.model}) : super(key: key);
@override
_IndexState createState() => new _IndexState();
}

class _IndexState extends State<Index>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
List _mapList = WidgetRoot.getAllWidgets();
int _currentIndex = -1;
TabController _tabController;

@override
bool get wantKeepAlive => true;

@override
initState() {
super.initState();
_tabController = new TabController(vsync: this, length: _mapList.length);
_tabController.addListener(() {
if (_currentIndex != _tabController.index) {
_currentIndex = _tabController.index;
}
});
}

@override
void dispose() {
_tabController.dispose();
super.dispose();
}

final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();

Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
/* appBar: AppBar(
title: Header.Index(
AppLocalizations.$t('nav_title_0'),
),
actions: appBarActions(),
), */
appBar: PreferredSize(
preferredSize: Size.fromHeight(kToolbarHeight),
child: Container(
color: Color(AppTheme.mainColor),
child: SafeArea(
child: this._TabBar(),
),
),
),
body: Column(
children: <Widget>[
//this._TabBar(),
this._TabView()
],
));
}

Widget _TabBar() {
return TabBar(
indicatorColor: Color(AppTheme.secondColor),
controller: _tabController,
isScrollable: true,
tabs: _mapList.map((v) {
return new Tab(
text: AppLocalizations.$t(v.typeName),
/* icon: Icon(
IconData(
v.code,
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
), */
);
}).toList());
}

Widget _TabView() {
return Expanded(
child: new TabBarView(
controller: _tabController,
children: List.generate(_mapList.length, (index) {
return this.Grids(_mapList[index], index);
})),
);
}

Widget Grids(widgetsItem, index) {
String nameSpaces = widgetsItem.nameSpaces;
List _tmpWidgetList = widgetsItem.widgetList;

return Container(
child: GridView.count(
childAspectRatio: 1.3,
padding: EdgeInsets.fromLTRB(4, 0, 4, 0),
shrinkWrap: true,
physics: ScrollPhysics(),
crossAxisCount: 3,
children: List.generate(
_tmpWidgetList.length,
(index) {
return Container(
decoration: BoxDecoration(
border:
Border.all(color: Color(AppTheme.lineColor), width: 0.5)),
child: FlatButton(
color: Color(AppTheme.secondColor),
splashColor: Color(AppTheme.mainColor),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(
IconData(
_tmpWidgetList[index].code,
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
color: Color(AppTheme.mainColor),
size: 32,
),
Text(
'${_tmpWidgetList[index].title}',
//overflow: TextOverflow.ellipsis,
style:
TextStyle(fontSize: 14, fontWeight: FontWeight.w300),
)
],
),
onPressed: () {
FluroRouter.router.navigateTo(
context,
nameSpaces + _tmpWidgetList[index].title,
);
},
),
);
},
),
),
);
}

List<Widget> appBarActions() {
return [
PopupMenuButton(
icon: Icon(
Icons.more_vert,
),
onSelected: (local) {
AppLocalizations.changeLanguage(Locale(local));
print('local=$local');
},
itemBuilder: (context) => [
PopupMenuItem(
child: Row(
children: <Widget>[
Text('中文'),
],
),
value: 'zh',
),
PopupMenuItem(
child: Row(
children: <Widget>[
Text('english'),
],
),
value: 'en',
),
],
),
];
}
}
Loading

0 comments on commit f9ccfb4

Please sign in to comment.