-
Notifications
You must be signed in to change notification settings - Fork 151
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
Ysz #3
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 9 additions & 14 deletions
README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
12 changes: 12 additions & 0 deletions
lib/components/markdownComp.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| ), | ||
| ); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file removed
lib/page/widgets_demo/index.dart
Empty file.
14 changes: 10 additions & 4 deletions
lib/router/scrollview/index.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
lib/widget/e_image.dart
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
lib/widget/scrollview/GridView/gridview.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.