Skip to content

Ysz #3

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 4 commits into from
Feb 19, 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
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
# Flutter UI v1.0

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
# 目录
```
__lib
__lang
__page
__router
__store
__widget
```
63 changes: 32 additions & 31 deletions assets/json/widget_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,43 @@
"widgetList": [
{
"code": 59101,
"name": "Row"
"name": "Row",
"key": "Row"
},
{
"code": 59103,
"name": "Column"
"name": "Column",
"key": "Column"
},
{
"code": 59105,
"name": "Container"
"name": "Container",
"key": "Container"
},
{
"code": 57897,
"name": "Center"
"name": "Center",
"key": "Center"
},
{
"code": 59497,
"name": "Padding"
"name": "Padding",
"key": "Padding"
},
{
"code": 59497,
"name": "Stack"
"name": "Stack",
"key": "Stack"
},
{
"code": 59497,
"name": "Expanded"
"name": "Expanded",
"key": "Expanded"
},
{
"code": 59497,
"name": "Align"
"name": "Align",
"key": "Align"
}
]
},
Expand All @@ -44,46 +52,39 @@
"code": 58353,
"widgetList": [
{
"name": "FittedBox"
"name": "FittedBox",
"key": "FittedBox"
},
{
"name": "ConstrainedBox"
"name": "ConstrainedBox",
"key": "ConstrainedBox"
},
{
"name": "DecoratedBox"
"name": "DecoratedBox",
"key": "DecoratedBox"
},
{
"name": "LimitedBox"
"name": "LimitedBox",
"key": "LimitedBox"
},
{
"name": "RotatedBox"
"name": "RotatedBox",
"key": "RotatedBox"
},
{
"name": "Table"
"name": "Table",
"key": "Table"
}
]
},
{
"typeName": "form",
"typeName": "scrollview",
"code": 58353,
"widgetList": [
{
"name": "FittedBox"
},
{
"name": "ConstrainedBox"
},
{
"name": "DecoratedBox"
},
{
"name": "LimitedBox"
},
{
"name": "RotatedBox"
},
{
"name": "Table"
"code": 59673,
"name": "GridView",
"key": "scrollview_gridview"
}
]
}
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions lib/components/markdownComp.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart' as md;

class MarkDownComp extends StatelessWidget {
final String data;
MarkDownComp(this.data);

@override
Widget build(BuildContext build ) {
return md.MarkdownBody(data: this.data);
}
}
36 changes: 36 additions & 0 deletions lib/components/widgetComp.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:efox_flutter/store/STORE.dart';
import 'package:efox_flutter/components/markdownComp.dart';

class WidgetComp extends StatelessWidget {
final dynamic modelChild;
final String title;

WidgetComp({Key key, this.title, @required this.modelChild})
: super(key: key);

@override
Widget build(BuildContext context) {
return STORE.connect(builder: (context, child, model) {
List _list = this.modelChild(context, child, model);
List<Widget> _bodyList = [];
_list.forEach((item) {
if (item.runtimeType == String) {
_bodyList.add(MarkDownComp(item));
} else {
_bodyList.add(item);
}
});
return Scaffold(
appBar: AppBar(
title: Text(this.title),
),
body: ListView(
padding: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
shrinkWrap: true,
children: _bodyList,
),
);
});
}
}
11 changes: 8 additions & 3 deletions lib/page/tabbar/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ class _ComponentsPageState extends State<ComponentsPage>
(index) {
return Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.deepOrange, width: 0.4),
border: Border(
bottom: BorderSide(
width: .1,
color: Colors.orange.shade300,
)
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -70,8 +75,8 @@ class _ComponentsPageState extends State<ComponentsPage>
color: Colors.deepOrange,
),
onPressed: () {
print('idndex, $index ${routesMap()['ScrollViewGridView']}');
Navigator.pushNamed(context, routesMap()['ScrollViewGridView']);
String _key = _tmpWidgetList[index].key;
Navigator.pushNamed(context, routesMap()['${_key}']);
},
),
Text(_tmpWidgetList[index].name),
Expand Down
Empty file removed lib/page/widgets_demo/index.dart
Empty file.
14 changes: 10 additions & 4 deletions lib/router/scrollview/index.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import 'package:flutter/widgets.dart';

import 'package:efox_flutter/widget/scrollview/gridview.dart';
import 'package:efox_flutter/widget/scrollview/GridView/gridview.dart';

const nameSpaces = 'scrollview_';
const gridview = nameSpaces + 'gridview';

const routerMaps = {
gridview: '/widget/scrollview/GridView/gridview',
};

Map<String, WidgetBuilder> getScrollViewRoutersConfig(BuildContext context) {
return {
'/widget/scrollview/gridview': (context) => GridViewDemo(),
routerMaps[gridview] : (context) => GridViewDemo(),
};
}

const nameSpaces = 'ScrollView';
Map<String, String> routesMapScrollView = {
nameSpaces + 'GridView': '/widget/scrollview/gridview',
gridview: routerMaps[gridview],
};
43 changes: 43 additions & 0 deletions lib/store/http.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:dio/dio.dart';
import 'dart:io';

class RestApi {
RestApi();
static Dio _dio;
static getDio([options]) {
if (RestApi._dio != null) {
return RestApi._dio;
}
Dio dio = new Dio(options);
// proxy
dio.onHttpClientCreate = (HttpClient client) {
// client.findProxy = (uri) {
// print(Index.proxyUrl);
// return Index.proxyUrl;
// };
};
RestApi._dio = dio;
return dio;
}

static request({method, url, data}) async {
Response<dynamic> response;
if (method == 'get') {
response = await RestApi.getDio().get(url, data: data);
} else {
response = await RestApi.getDio().post(url, data: data);
}
return response.data;
}

// dio.post('/test', data: {id:'123'})
static post(url, [data]) async{
return await RestApi.getDio().post(url, data: data);
}

// dio.get('/test', {data: {}})
// dio.get('/test?id=123')
static get(url, [data]) async {
return await RestApi.getDio().get(url, data: data);
}
}
2 changes: 2 additions & 0 deletions lib/store/objects/widget_list.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class ItemInfo extends Object {
int code;
String name;
String key;

ItemInfo.fromJson(Map<String, dynamic> json) {
code = json['code'];
name = json['name'];
key = json['key'];
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/widget/e_image.dart

This file was deleted.

41 changes: 41 additions & 0 deletions lib/widget/scrollview/GridView/gridview.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:efox_flutter/components/widgetComp.dart';
import 'package:efox_flutter/store/http.dart';
import 'intro.dart';

class GridViewDemo extends StatefulWidget {
@override
_GridViewDemoState createState() => new _GridViewDemoState();
}

class _GridViewDemoState extends State<GridViewDemo> {
String mdList = '';
@override
void initState() {
super.initState();
this.initMd ();
}
initMd () async {
dynamic res = await RestApi.get('https://wanwusangzhi.github.io/WebStudy/readme.md');
setState(() {
this.mdList = res.toString();
});
}
@override
Widget build(BuildContext context) {
return WidgetComp(
title: 'GridViewDemo',
modelChild: (context, child, model) {
return [
md_01,
mdList,
Container(
color: Colors.teal.shade700,
alignment: Alignment.center,
child: Text('Hello WorldHello WorldHello WorldHello WorldHello World', style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)),
),
];
},
);
}
}
28 changes: 28 additions & 0 deletions lib/widget/scrollview/GridView/intro.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';

const md_01 = """
### ***GridView***

> GridView可创建一个二维的网格布局
```

GridView({
Key key,
Axis scrollDirection: Axis.vertical,
bool reverse: false,
ScrollController controller,
bool primary,
ScrollPhysics physics,
bool shrinkWrap: false,
EdgeInsetsGeometry padding,
@required SliverGridDelegate gridDelegate,
bool addAutomaticKeepAlives: true,
bool addRepaintBoundaries: true,
bool addSemanticIndexes: true,
double cacheExtent,
List<Widget> children: const [],
int semanticChildCount
})
```

""";
26 changes: 0 additions & 26 deletions lib/widget/scrollview/gridview.dart

This file was deleted.

Loading