Skip to content

Commit

Permalink
🥝 modify some colors
Browse files Browse the repository at this point in the history
  • Loading branch information
persilee committed Jun 28, 2020
1 parent 73e1239 commit de608e1
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 38 deletions.
40 changes: 15 additions & 25 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

### 更新日志

- 2020-06-28 08:44 新增 My Page 案例
- 2020-06-28 07:15 新增 **futureBuilder****streamBuilder** 的使用案例
- 2020-06-27 02:15 新增 **provider** 的使用案例
- 2020-06-26 23:56 调整整体目录结构
Expand Down
2 changes: 2 additions & 0 deletions lib/demo/base_widget_demo/my_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class _MyPageState extends State<MyPage> {
removeTop: true,
child: RefreshIndicator(
onRefresh: _handleRefresh,
color: Colors.yellow,
backgroundColor: Colors.black38,
child: ListView(
children: <Widget>[
Container(
Expand Down
5 changes: 4 additions & 1 deletion lib/demo/stream_demo/base_stateful_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class _BaseStatefulDemoState extends State<BaseStatefulDemo> {
),
body: _fetchingData
? Center(
child: CircularProgressIndicator(),
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.amber),
backgroundColor: Colors.yellow,
),
)
: ListView.builder(
itemCount: _pageData.length,
Expand Down
16 changes: 10 additions & 6 deletions lib/demo/stream_demo/future_builder_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:math';
import 'package:flutter/material.dart';

class FutureBuilderDemo extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -13,15 +12,20 @@ class FutureBuilderDemo extends StatelessWidget {
body: FutureBuilder(
future: _getListData(),
builder: (buildContext, snapshot) {
if(snapshot.hasError) {
if (snapshot.hasError) {
return _getInfoMessage(snapshot.error);
}

if(!snapshot.hasData) {
return Center(child: CircularProgressIndicator(),);
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.amber),
backgroundColor: Colors.yellow,
),
);
}
var listData = snapshot.data;
if(listData.length == 0) {
if (listData.length == 0) {
return _getInfoMessage('No data found');
}

Expand All @@ -43,7 +47,7 @@ class FutureBuilderDemo extends StatelessWidget {
);
}

Widget _getInfoMessage(String msg){
Widget _getInfoMessage(String msg) {
return Center(
child: Text(msg),
);
Expand Down
15 changes: 9 additions & 6 deletions lib/demo/stream_demo/stream_builder_demo.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@

import 'package:flutter/material.dart';
import 'package:pro_flutter/demo/stream_demo/stream_demo_event.dart';
import 'package:pro_flutter/demo/stream_demo/stream_demo_model.dart';
import 'package:pro_flutter/demo/stream_demo/stream_demo_state.dart';

class StreamBuilderDemo extends StatefulWidget {

@override
_StreamBuilderDemoState createState() => _StreamBuilderDemoState();
}

class _StreamBuilderDemoState extends State<StreamBuilderDemo> {

final model = StreamDemoModel();

@override
Expand All @@ -28,7 +25,10 @@ class _StreamBuilderDemoState extends State<StreamBuilderDemo> {
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.yellow,
child: Icon(Icons.cached, color: Colors.black87,),
child: Icon(
Icons.cached,
color: Colors.black87,
),
onPressed: () {
model.dispatch(FetchData());
},
Expand All @@ -44,12 +44,15 @@ class _StreamBuilderDemoState extends State<StreamBuilderDemo> {

if (!snapshot.hasData || homeState is BusyState) {
return Center(
child: CircularProgressIndicator(),
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.amber),
backgroundColor: Colors.yellow,
),
);
}

if (homeState is DataFetchedState) {
if(!homeState.hasData) {
if (!homeState.hasData) {
return _getInformationMessage('not found data');
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class App extends StatelessWidget {
},
theme: ThemeData(
primaryColor: Colors.yellow,
accentColor: Colors.amber,
highlightColor: Color.fromRGBO(255, 255, 255, 0.6),
splashColor: Colors.white70,
),
Expand Down

0 comments on commit de608e1

Please sign in to comment.