fix: code conflict

This commit is contained in:
yifeng.yl
2019-02-03 00:48:57 +08:00
181 changed files with 2261 additions and 1158 deletions

View File

@ -16,7 +16,7 @@ No
This Project need latest package, please update regularly. This Project need latest package, please update regularly.
- dart(version: 2.0.0) - dart(version: 2.0.0)
- flutter(version: v1.1.10) - flutter(version: v1.0.0)
### Background ### Background

View File

@ -26,7 +26,7 @@ iphone下载地址:
本项目环境持续更新. 请定期更新各依赖包. 本项目环境持续更新. 请定期更新各依赖包.
- dart(version: 2.0.0) - dart(version: 2.0.0)
- flutter(version: v1.1.10) - flutter(version: v1.0.0)
### 背景 ### 背景

View File

@ -8,6 +8,8 @@ public class MainActivity extends FlutterActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
GeneratedPluginRegistrant.registerWith(this); GeneratedPluginRegistrant.registerWith(this);
} }
} }

View File

@ -4,9 +4,9 @@
<item android:drawable="@android:color/white" /> <item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here --> <!-- You can insert your own image assets here -->
<!-- <item> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
android:src="@mipmap/launch_image" /> android:src="@mipmap/splash" />
</item> --> </item>
</layer-list> </layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash">
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

View File

@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
084A20882202E4FD00428FF5 /* flutter go.png in Resources */ = {isa = PBXBuildFile; fileRef = 084A20872202E4FD00428FF5 /* flutter go.png */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; }; 333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
@ -37,6 +38,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
084A20872202E4FD00428FF5 /* flutter go.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flutter go.png"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
@ -101,6 +103,7 @@
97C146E51CF9000F007C117D = { 97C146E51CF9000F007C117D = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
084A20872202E4FD00428FF5 /* flutter go.png */,
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
@ -206,6 +209,7 @@
files = ( files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
084A20882202E4FD00428FF5 /* flutter go.png in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
); );
@ -445,7 +449,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterRookieBook; PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -469,7 +473,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterRookieBook; PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View File

@ -7,6 +7,7 @@
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self]; [GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch. // Override point for customization after application launch.
[NSThread sleepForTimeInterval:2];
return [super application:application didFinishLaunchingWithOptions:launchOptions]; return [super application:application didFinishLaunchingWithOptions:launchOptions];
} }

View File

@ -2,17 +2,17 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "LaunchImage.png", "filename" : "flutter go.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "LaunchImage@2x.png", "filename" : "flutter go-1.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "LaunchImage@3x.png", "filename" : "flutter go-2.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
@ -20,4 +20,4 @@
"version" : 1, "version" : 1,
"author" : "xcode" "author" : "xcode"
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
@ -14,24 +18,36 @@
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
<rect key="frame" x="0.0" y="0.0" width="1080" height="1920"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="1920" id="OLo-sE-hO2"/>
<constraint firstAttribute="height" constant="1920" id="YT6-bb-oIb"/>
<constraint firstAttribute="width" constant="1080" id="n6M-3x-zje"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="1080" id="qQn-AH-FYP"/>
</constraints>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
<constraint firstAttribute="bottom" secondItem="YRO-k0-Ey4" secondAttribute="bottom" id="T5g-9A-c9v"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="eyW-WF-YgD"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="veX-UW-bF2"/>
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="yhF-ag-fuv"/>
</constraints> </constraints>
</view> </view>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="53" y="375"/> <point key="canvasLocation" x="84.799999999999997" y="337.33133433283359"/>
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="LaunchImage" width="168" height="185"/> <image name="LaunchImage" width="1080" height="1920"/>
</resources> </resources>
</document> </document>

BIN
ios/flutter go.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@ -33,11 +33,13 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
void refs(bool value) async { void refs(bool value) async {
final SharedPreferences prefs = await _prefs; final SharedPreferences prefs = await _prefs;
final bool unKnow = value; final bool unKnow = value;
setState(() { if (mounted) {
_unKnow = prefs.setBool("disclaimer::Boolean", unKnow).then((bool success) { setState(() {
return unKnow; _unKnow = prefs.setBool("disclaimer::Boolean", unKnow).then((bool success) {
return unKnow;
});
}); });
}); }
} }
@override @override
@ -135,12 +137,12 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
tristate: false, tristate: false,
value: _valBool, value: _valBool,
onChanged: (bool bol) { onChanged: (bool bol) {
setState(() { if(mounted) {
_valBool = bol; setState(() {
}); _valBool = bol;
// refs(bol); });
Navigator.of(context) }
.pop(); // here I pop to avoid multiple Dialogs Navigator.of(context).pop(); // here I pop to avoid multiple Dialogs
showAlertDialog(context); //here i call the same function showAlertDialog(context); //here i call the same function
}), }),
Text('不再自动提示', style: TextStyle(fontSize: 14)), Text('不再自动提示', style: TextStyle(fontSize: 14)),

View File

@ -20,6 +20,7 @@ class _FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
print('widget.filePath=======${widget.filePath}');
getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context)) getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context))
.then<void>((String code) { .then<void>((String code) {
if (mounted) { if (mounted) {

View File

@ -61,7 +61,9 @@ class _ListRefreshState extends State<ListRefresh> {
Future _getMoreData() async { Future _getMoreData() async {
if (!isLoading && _hasMore) { if (!isLoading && _hasMore) {
// 如果上一次异步请求数据完成 同时有数据可以加载 // 如果上一次异步请求数据完成 同时有数据可以加载
setState(() => isLoading = true); if (mounted) {
setState(() => isLoading = true);
}
//if(_hasMore){ // 还有数据可以拉新 //if(_hasMore){ // 还有数据可以拉新
List newEntries = await mokeHttpRequest(); List newEntries = await mokeHttpRequest();
//if (newEntries.isEmpty) { //if (newEntries.isEmpty) {

View File

@ -4,20 +4,31 @@ import 'package:flutter/rendering.dart';
import 'routers/routers.dart'; import 'routers/routers.dart';
import 'routers/application.dart'; import 'routers/application.dart';
import 'package:flutter_go/utils/provider.dart'; import 'package:flutter_go/utils/provider.dart';
import 'package:flutter_go/utils/shared_preferences.dart';
import 'package:flutter_go/views/first_page/home.dart';
import 'views/welcome_page/index.dart'; import 'views/welcome_page/index.dart';
const int ThemeColor = 0xFFC91B3A; const int ThemeColor = 0xFFC91B3A;
SpUtil sp;
var db;
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
MyApp() { MyApp() {
final router = new Router(); final router = new Router();
Routes.configureRoutes(router); Routes.configureRoutes(router);
Application.router = router; Application.router = router;
} }
showWelcomePage() {
bool showWelcome = sp.getBool(sharedPreferencesKeys.showWelcome);
if (showWelcome == null || showWelcome == true) {
return WelcomePage();
} else {
return AppPage();
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
showWelcomePage();
return new MaterialApp( return new MaterialApp(
title: 'title', title: 'title',
theme: new ThemeData( theme: new ThemeData(
@ -34,18 +45,18 @@ class MyApp extends StatelessWidget {
), ),
), ),
home: new Scaffold( home: new Scaffold(
body: new WelcomePage(), body: showWelcomePage()
), ),
onGenerateRoute: Application.router.generator, onGenerateRoute: Application.router.generator,
); );
} }
} }
var db;
void main() async { void main() async {
final provider = new Provider(); final provider = new Provider();
await provider.init(true); await provider.init(true);
sp = await SpUtil.getInstance();
db = Provider.db; db = Provider.db;
runApp(new MyApp()); runApp(new MyApp());
} }

View File

@ -0,0 +1,30 @@
/**
* Created with Android Studio.
* User: 三帆
* Date: 31/01/2019
* Time: 18:13
* email: sanfan.hx@alibaba-inc.com
* tartget: xxx
*/
//enum DateType {
// Int,
// Double,
// Bool,
// String,
// Dynamic
//}
//class spKey {
// String name;
// DateType type;
//
// spKey({this.name, this.type});
//}
class sharedPreferencesKeys {
/// boolean
/// 用于欢迎页面. 只有第一次访问才会显示. 或者手动将这个值设为false
static String showWelcome = 'loginWelcone';
}

View File

@ -78,6 +78,9 @@ class WidgetName2Icon {
"IconData":Icons.date_range, "IconData":Icons.date_range,
"IconThemeData":Icons.insert_comment, "IconThemeData":Icons.insert_comment,
"Canvas":Icons.edit, "Canvas":Icons.edit,
"PainterPath":Icons.gesture,
"CircleProgressBarPainter":Icons.av_timer,
"PainterSketch":Icons.touch_app,
"Material":Icons.android, "Material":Icons.android,
"MaterialApp":Icons.android, "MaterialApp":Icons.android,
"MaterialButton":Icons.speaker, "MaterialButton":Icons.speaker,

View File

@ -1,8 +1,11 @@
import 'package:fluro/fluro.dart'; import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_go/utils/shared_preferences.dart';
class Application { class Application {
static Router router; static Router router;
static TabController controller; static TabController controller;
static SpUtil sharePeferences;
static Map<String, String> github = { static Map<String, String> github = {
'widgetsURL':'https://github.com/alibaba/flutter-go/blob/develop/lib/widgets/', 'widgetsURL':'https://github.com/alibaba/flutter-go/blob/develop/lib/widgets/',
//'develop':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/develop/lib/widgets/', //'develop':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/develop/lib/widgets/',

View File

@ -59,6 +59,7 @@ class Provider {
//Get a location using getDatabasesPath //Get a location using getDatabasesPath
String databasesPath = await getDatabasesPath(); String databasesPath = await getDatabasesPath();
String path = join(databasesPath, 'flutter.db'); String path = join(databasesPath, 'flutter.db');
print(path);
try { try {
db = await openDatabase(path); db = await openDatabase(path);
} catch (e) { } catch (e) {

View File

@ -0,0 +1,119 @@
import 'dart:async';
import 'package:shared_preferences/shared_preferences.dart';
export 'package:flutter_go/resources/shared_preferences_keys.dart';
///
/// 用来做shared_preferences的存储
class SpUtil {
static SpUtil _instance;
static Future<SpUtil> get instance async {
return await getInstance();
}
static SharedPreferences _spf;
SpUtil._();
Future _init() async {
_spf = await SharedPreferences.getInstance();
}
static Future<SpUtil> getInstance() async {
print("_instance>>$_instance");
if (_instance == null) {
_instance = new SpUtil._();
await _instance._init();
}
return _instance;
}
static bool _beforCheck() {
if (_spf == null) {
return true;
}
return false;
}
// 判断是否存在数据
bool hasKey(String key) {
Set keys = getKeys();
return keys.contains(key);
}
Set<String> getKeys() {
if (_beforCheck()) return null;
return _spf.getKeys();
}
get(String key) {
if (_beforCheck()) return null;
return _spf.get(key);
}
getString(String key) {
if (_beforCheck()) return null;
return _spf.getString(key);
}
Future<bool> putString(String key, String value) {
if (_beforCheck()) return null;
return _spf.setString(key, value);
}
bool getBool(String key) {
if (_beforCheck()) return null;
return _spf.getBool(key);
}
Future<bool> putBool(String key, bool value) {
if (_beforCheck()) return null;
return _spf.setBool(key, value);
}
int getInt(String key) {
if (_beforCheck()) return null;
return _spf.getInt(key);
}
Future<bool> putInt(String key, int value) {
if (_beforCheck()) return null;
return _spf.setInt(key, value);
}
double getDouble(String key) {
if (_beforCheck()) return null;
return _spf.getDouble(key);
}
Future<bool> putDouble(String key, double value) {
if (_beforCheck()) return null;
return _spf.setDouble(key, value);
}
List<String> getStringList(String key) {
return _spf.getStringList(key);
}
Future<bool> putStringList(String key, List<String> value) {
if (_beforCheck()) return null;
return _spf.setStringList(key, value);
}
dynamic getDynamic(String key) {
if (_beforCheck()) return null;
return _spf.get(key);
}
Future<bool> remove(String key) {
if (_beforCheck()) return null;
return _spf.remove(key);
}
Future<bool> clear() {
if (_beforCheck()) return null;
return _spf.clear();
}
}

View File

@ -17,7 +17,7 @@ class FirstPage extends StatefulWidget {
} }
class FirstPageState extends State<FirstPage> with AutomaticKeepAliveClientMixin{ class FirstPageState extends State<FirstPage> with AutomaticKeepAliveClientMixin{
Future<SharedPreferences> _prefs=SharedPreferences.getInstance(); Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
Future<bool> _unKnow; Future<bool> _unKnow;
@override @override

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../routers/application.dart'; import '../../routers/application.dart';
import '../../routers/routers.dart'; import '../../routers/routers.dart';
import '../../utils/shared_preferences.dart';
final pages = [ final pages = [
new PageViewModel( new PageViewModel(
@ -30,7 +31,7 @@ final pages = [
class Page extends StatelessWidget { class Page extends StatelessWidget {
final PageViewModel viewModel; final PageViewModel viewModel;
final double percentVisible; final double percentVisible;
SpUtil sp;
Page({ Page({
this.viewModel, this.viewModel,
this.percentVisible = 1.0, this.percentVisible = 1.0,
@ -43,8 +44,10 @@ class Page extends StatelessWidget {
Widget creatButton( Widget creatButton(
BuildContext context, String txt, IconData iconName, String type) { BuildContext context, String txt, IconData iconName, String type) {
return RaisedButton.icon( return RaisedButton.icon(
onPressed: () { onPressed: () async {
if (type == 'start') { if (type == 'start') {
await SpUtil.getInstance()
..putBool(sharedPreferencesKeys.showWelcome, false);
_goHomePage(context); _goHomePage(context);
} else if (type == 'goGithub') { } else if (type == 'goGithub') {
Application.router.navigateTo(context, Application.router.navigateTo(context,

View File

@ -24,52 +24,54 @@ class FourthPageState extends State<FourthPage> with TickerProviderStateMixin {
slideUpdateStream = new StreamController<SlideUpdate>(); slideUpdateStream = new StreamController<SlideUpdate>();
slideUpdateStream.stream.listen((SlideUpdate event) { slideUpdateStream.stream.listen((SlideUpdate event) {
setState(() { if(mounted) {
if (event.updateType == UpdateType.dragging) { setState(() {
slideDirection = event.direction; if (event.updateType == UpdateType.dragging) {
slidePercent = event.slidePercent; slideDirection = event.direction;
slidePercent = event.slidePercent;
if (slideDirection == SlideDirection.leftToRight) { if (slideDirection == SlideDirection.leftToRight) {
nextPageIndex = activeIndex - 1; nextPageIndex = activeIndex - 1;
} else if (slideDirection == SlideDirection.rightToLeft) { } else if (slideDirection == SlideDirection.rightToLeft) {
nextPageIndex = activeIndex + 1; nextPageIndex = activeIndex + 1;
} else { } else {
nextPageIndex = activeIndex; nextPageIndex = activeIndex;
}
} else if (event.updateType == UpdateType.doneDragging) {
if (slidePercent > 0.5) {
animatedPageDragger = new AnimatedPageDragger(
slideDirection: slideDirection,
transitionGoal: TransitionGoal.open,
slidePercent: slidePercent,
slideUpdateStream: slideUpdateStream,
vsync: this,
);
} else {
animatedPageDragger = new AnimatedPageDragger(
slideDirection: slideDirection,
transitionGoal: TransitionGoal.close,
slidePercent: slidePercent,
slideUpdateStream: slideUpdateStream,
vsync: this,
);
nextPageIndex = activeIndex;
}
animatedPageDragger.run();
} else if (event.updateType == UpdateType.animating) {
slideDirection = event.direction;
slidePercent = event.slidePercent;
} else if (event.updateType == UpdateType.doneAnimating) {
activeIndex = nextPageIndex;
slideDirection = SlideDirection.none;
slidePercent = 0.0;
animatedPageDragger.dispose();
} }
} else if (event.updateType == UpdateType.doneDragging) { });
if (slidePercent > 0.5) { }
animatedPageDragger = new AnimatedPageDragger(
slideDirection: slideDirection,
transitionGoal: TransitionGoal.open,
slidePercent: slidePercent,
slideUpdateStream: slideUpdateStream,
vsync: this,
);
} else {
animatedPageDragger = new AnimatedPageDragger(
slideDirection: slideDirection,
transitionGoal: TransitionGoal.close,
slidePercent: slidePercent,
slideUpdateStream: slideUpdateStream,
vsync: this,
);
nextPageIndex = activeIndex;
}
animatedPageDragger.run();
} else if (event.updateType == UpdateType.animating) {
slideDirection = event.direction;
slidePercent = event.slidePercent;
} else if (event.updateType == UpdateType.doneAnimating) {
activeIndex = nextPageIndex;
slideDirection = SlideDirection.none;
slidePercent = 0.0;
animatedPageDragger.dispose();
}
});
}); });
} }

View File

@ -9,7 +9,7 @@ class WidgetNotFound extends StatelessWidget {
title: Text("widget not found"), title: Text("widget not found"),
), ),
body: Container( body: Container(
child: new Text("widget not found") child: Text("widget not found")
) )
); );
} }

View File

@ -30,8 +30,8 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_scrollViewController = new ScrollController(); _scrollViewController = ScrollController();
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应 _tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
} }
@override @override
@ -46,26 +46,26 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child:new AppBar( // 大量配置属性参考 SliverAppBar 示例 child: AppBar( // 大量配置属性参考 SliverAppBar 示例
title: new Text('title'), title: Text('title'),
leading: new Icon(Icons.home), leading: Icon(Icons.home),
backgroundColor: Colors.amber[500], backgroundColor: Colors.amber[500],
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: <Widget>[
new IconButton( IconButton(
icon: new Icon(Icons.add_alarm), icon: Icon(Icons.add_alarm),
tooltip: 'Add Alarm', tooltip: 'Add Alarm',
onPressed: () { onPressed: () {
// do nothing // do nothing
}), }),
new PopupMenuButton<String>( PopupMenuButton<String>(
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>( PopupMenuItem<String>(
value: "price", child: new Text('Sort by price')), value: "price", child: Text('Sort by price')),
new PopupMenuItem<String>( PopupMenuItem<String>(
value: "time", child: new Text('Sort by time')), value: "time", child: Text('Sort by time')),
], ],
onSelected: (String action) { onSelected: (String action) {
switch (action) { switch (action) {
@ -78,16 +78,16 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
} }
}) })
], ],
bottom: new TabBar( bottom: TabBar(
isScrollable: true, isScrollable: true,
controller: _tabController, controller: _tabController,
tabs: <Widget>[ tabs: <Widget>[
new Tab(text: "Tabs 1"), Tab(text: "Tabs 1"),
new Tab(text: "Tabs 2"), Tab(text: "Tabs 2"),
new Tab(text: "Tabs 3"), Tab(text: "Tabs 3"),
new Tab(text: "Tabs 4"), Tab(text: "Tabs 4"),
new Tab(text: "Tabs 5"), Tab(text: "Tabs 5"),
new Tab(text: "Tabs 6"), Tab(text: "Tabs 6"),
], ],
), ),
), ),
@ -107,7 +107,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SizedBox( return SizedBox(
height: 200, height: 200,
child:AppBar( child:AppBar(
title: Text('My Fancy Dress'), title: Text('My Fancy Dress'),

View File

@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -84,7 +84,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -21,7 +21,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SizedBox( return SizedBox(
height: 100, height: 100,
child: Scaffold( child: Scaffold(
//appBar: AppBar(title: const Text('Bottom App Bar')), //appBar: AppBar(title: const Text('Bottom App Bar')),

View File

@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -44,9 +44,9 @@ class ButtonBarLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: new EdgeInsets.symmetric(vertical: 0.0), margin: EdgeInsets.symmetric(vertical: 0.0),
height: 100.0, height: 100.0,
child: new Scrollbar(child:ListView( child: Scrollbar(child:ListView(
scrollDirection: Axis.horizontal, // 水平listView scrollDirection: Axis.horizontal, // 水平listView
children: <Widget>[ children: <Widget>[
ButtonBar( ButtonBar(

View File

@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -44,9 +44,9 @@ class SliverAppBarLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
listData.add(new ListItem("我是测试标题$i", Icons.cake)); listData.add( ListItem("我是测试标题$i", Icons.cake));
} }
return new SizedBox( return SizedBox(
height: 500.0, height: 500.0,
child: NestedScrollView( child: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
@ -89,7 +89,7 @@ class SliverAppBarLessDefault extends StatelessWidget {
// SliverPersistentHeader( // SliverPersistentHeader(
// delegate: _SliverAppBarDelegate( // delegate: _SliverAppBarDelegate(
// TabBar( // TabBar(
// controller: new TabController(length: 2, vsync: this), // controller: TabController(length: 2, vsync: this),
// labelColor: Colors.black87, // labelColor: Colors.black87,
// unselectedLabelColor: Colors.grey, // unselectedLabelColor: Colors.grey,
// tabs: [ // tabs: [
@ -101,10 +101,10 @@ class SliverAppBarLessDefault extends StatelessWidget {
]; ];
}, },
body: Center( body: Center(
child: new ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return new ListItemWidget(listData[index]); return ListItemWidget(listData[index]);
}, },
itemCount: listData.length, itemCount: listData.length,
), ),
@ -127,10 +127,10 @@ class ListItemWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new InkWell( return InkWell(
child: new ListTile( child: ListTile(
leading: new Icon(listItem.iconData), leading: Icon(listItem.iconData),
title: new Text(listItem.title), title: Text(listItem.title),
), ),
onTap: () {}, onTap: () {},
); );

View File

@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -71,7 +71,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -23,15 +23,15 @@ class SnackBarLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// 当BuildContext在Scaffold之前时调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决 // 当BuildContext在Scaffold之前时调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决
return new Center( return Center(
child: new Column( child: Column(
children: <Widget>[ children: <Widget>[
new GestureDetector( GestureDetector(
onTap: () { onTap: () {
final snackBar = new SnackBar( final snackBar = SnackBar(
content: new Text('这是一个SnackBar, 右侧有SnackBarAction'), content: Text('这是一个SnackBar, 右侧有SnackBarAction'),
backgroundColor:Colors.red, backgroundColor:Colors.red,
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮 action: SnackBarAction( // 提示信息上添加一个撤消的按钮
textColor:Colors.black, textColor:Colors.black,
label: '撤消', label: '撤消',
onPressed: () { onPressed: () {
@ -43,19 +43,19 @@ class SnackBarLessDefault extends StatelessWidget {
); );
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('显示SnackBar'), child: Text('显示SnackBar'),
), ),
new GestureDetector( GestureDetector(
onTap: () { onTap: () {
final snackBar = new SnackBar( final snackBar = SnackBar(
content: new Text('右侧无SnackBarAction'), content: Text('右侧无SnackBarAction'),
backgroundColor:Colors.red, backgroundColor:Colors.red,
duration:Duration(minutes: 1),// 持续时间 duration:Duration(minutes: 1),// 持续时间
//animation, //animation,
); );
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('显示无SnackBarAction的SnackBar'), child: Text('显示无SnackBarAction的SnackBar'),
), ),
], ],
) )

View File

@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -72,7 +72,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -16,15 +16,15 @@ class SnackBarActionDemo extends StatefulWidget {
class _Demo extends State<SnackBarActionDemo> { class _Demo extends State<SnackBarActionDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Center( return Center(
child: new Column( child: Column(
children: <Widget>[ children: <Widget>[
new GestureDetector( new RaisedButton(
onTap: () { onPressed: () {
final snackBar = new SnackBar( final snackBar = new SnackBar(
content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'), content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'),
backgroundColor:Color(0xffc91b3a), backgroundColor:Color(0xffc91b3a),
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮 action: SnackBarAction( // 提示信息上添加一个撤消的按钮
textColor:Colors.white, textColor:Colors.white,
label: '撤消', label: '撤消',
onPressed: () { onPressed: () {
@ -37,10 +37,10 @@ class _Demo extends State<SnackBarActionDemo> {
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('点我显示有action的SnackBar'), child: Text('点我显示有action的SnackBar'),
), ),
new GestureDetector( new RaisedButton(
onTap: () async { onPressed: () async {
final snackBar = new SnackBar( final snackBar = new SnackBar(
content: new Text('右侧无SnackBarAction, 3秒后消失'), content: new Text('右侧无SnackBarAction, 3秒后消失'),
backgroundColor:Color(0xffc91b3a), backgroundColor:Color(0xffc91b3a),
@ -49,7 +49,7 @@ class _Demo extends State<SnackBarActionDemo> {
); );
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('点我显示无SnackBarAction的SnackBar'), child: Text('点我显示无SnackBarAction的SnackBar'),
), ),
], ],
) )

View File

@ -26,8 +26,8 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_scrollViewController = new ScrollController(); _scrollViewController = ScrollController();
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应 _tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
} }
@override @override
@ -42,27 +42,27 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child:new Scaffold( child: Scaffold(
appBar: new AppBar( // 大量配置属性参考 SliverAppBar 示例 appBar: AppBar( // 大量配置属性参考 SliverAppBar 示例
title: new Text('TabBar'), title: Text('TabBar'),
leading: new Icon(Icons.home), leading: Icon(Icons.home),
backgroundColor: Colors.amber[1000], backgroundColor: Colors.amber[1000],
bottom: new TabBar( bottom: TabBar(
isScrollable: true, isScrollable: true,
controller: _tabController, controller: _tabController,
tabs: <Widget>[ tabs: <Widget>[
new Tab(text: "Tabs 1"), Tab(text: "Tabs 1"),
new Tab(text: "Tabs 2"), Tab(text: "Tabs 2"),
new Tab(text: "Tabs 3"), Tab(text: "Tabs 3"),
new Tab(text: "Tabs 4"), Tab(text: "Tabs 4"),
new Tab(text: "Tabs 5"), Tab(text: "Tabs 5"),
new Tab(text: "Tabs 6"), Tab(text: "Tabs 6"),
], ],
), ),
), ),
body: new TabBarView(controller: _tabController, children: <Widget>[ body: TabBarView(controller: _tabController, children: <Widget>[
Text('TabsView 1'), Text('TabsView 1'),
Text('TabsView 2'), Text('TabsView 2'),
Text('TabsView 3'), Text('TabsView 3'),

View File

@ -50,9 +50,9 @@ class CardLessDefault extends StatelessWidget {
margin:EdgeInsets.all(20.0), margin:EdgeInsets.all(20.0),
// margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距 // margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距
semanticContainer:true, // 表示单个语义容器还是false表示单个语义节点的集合接受单个child但该child可以是RowColumn或其他包含子级列表的widget semanticContainer:true, // 表示单个语义容器还是false表示单个语义节点的集合接受单个child但该child可以是RowColumn或其他包含子级列表的widget
// shape:new Border.all( // shape: Border.all(
// color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框 // color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框
shape:RoundedRectangleBorder(borderRadius: new BorderRadius.circular(20.0)), // 圆角 shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), // 圆角
//borderRadius: BorderRadius.all(Radius.circular(8.0)), //borderRadius: BorderRadius.all(Radius.circular(8.0)),
child: Column( //card里面的子控件 child: Column( //card里面的子控件
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

View File

@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -19,9 +19,9 @@ class _Demo extends State<AboutDialogDemo> {
void showAlertDialog(BuildContext context) { void showAlertDialog(BuildContext context) {
showDialog( showDialog(
context: context, context: context,
builder: (_) => new AboutDialog( builder: (_) => AboutDialog(
applicationName: '名称', applicationName: '名称',
applicationIcon: new Icon(Icons.ac_unit), applicationIcon: Icon(Icons.ac_unit),
applicationVersion: 'V1.0', applicationVersion: 'V1.0',
children: <Widget>[ children: <Widget>[
Text('我是一个关于的dialog') Text('我是一个关于的dialog')
@ -29,12 +29,12 @@ class _Demo extends State<AboutDialogDemo> {
)); ));
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'show aboutDialog', 'show aboutDialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -119,12 +119,12 @@ class AlertDialogDemo extends StatelessWidget{
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'点我显示 AlertDialog', '点我显示 AlertDialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -42,12 +42,12 @@ class _Demo extends State<DialogDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'点我显示 Dialog', '点我显示 Dialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),
@ -108,14 +108,14 @@ class _DialogMoreDemo extends State<DialogMoreDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new RaisedButton( RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'点我显示Dialog', '点我显示Dialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -20,17 +20,17 @@ class _Demo extends State<SimpleDialogDemo> {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return new SimpleDialog( return SimpleDialog(
title: new Text('选择'), title: Text('选择'),
children: <Widget>[ children: <Widget>[
new SimpleDialogOption( SimpleDialogOption(
child: new Text('选项 1'), child: Text('选项 1'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
new SimpleDialogOption( SimpleDialogOption(
child: new Text('选项 2'), child: Text('选项 2'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -41,12 +41,12 @@ class _Demo extends State<SimpleDialogDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'show SimpleDialog', 'show SimpleDialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridPaperDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -40,21 +40,21 @@ class _Demo extends State<GridPaperDemo> {
), ),
GridPaper( GridPaper(
color: Colors.red, color: Colors.red,
child: new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), child: Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -36,21 +36,21 @@ class _Demo extends State<GridTileDemo> {
), ),
footer: Text("GridTile footer", style: TextStyle(color: Colors.white)), footer: Text("GridTile footer", style: TextStyle(color: Colors.white)),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
child: Container(), child: Container(),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
child: Container(), child: Container(),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -17,34 +17,34 @@ class SliverGridDemo extends StatefulWidget {
class _Demo extends State<SliverGridDemo> { class _Demo extends State<SliverGridDemo> {
Widget showCustomScrollView() { Widget showCustomScrollView() {
return new CustomScrollView( return CustomScrollView(
slivers: <Widget>[ slivers: <Widget>[
new SliverGrid( SliverGrid(
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200.0, maxCrossAxisExtent: 200.0,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0, crossAxisSpacing: 10.0,
childAspectRatio: 4.0, childAspectRatio: 4.0,
), ),
delegate: new SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
return new Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
color: Colors.cyan[100 * (index % 5)], color: Colors.cyan[100 * (index % 5)],
child: new Text('grid item $index'), child: Text('grid item $index'),
); );
}, },
childCount: 20, childCount: 20,
), ),
), ),
// new SliverFixedExtentList( // SliverFixedExtentList(
// itemExtent: 100.0, // itemExtent: 100.0,
// delegate: new SliverChildBuilderDelegate( // delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) { // (BuildContext context, int index) {
// return new Container( // return Container(
// alignment: Alignment.center, // alignment: Alignment.center,
// color: Colors.lightBlue[100 * (index % 9)], // color: Colors.lightBlue[100 * (index % 9)],
// child: new Text('list item $index'), // child: Text('list item $index'),
// ); // );
// }, // },
// ), // ),

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_go/widgets/components/LIst/AnimatedList/model.dart'; import 'package:flutter_go/widgets/components/List/AnimatedList/model.dart';
class AnimatedListFullDefault extends StatefulWidget { class AnimatedListFullDefault extends StatefulWidget {
AnimatedListFullDefault({Key key, this.parent}) : super(key: key); AnimatedListFullDefault({Key key, this.parent}) : super(key: key);
@ -15,7 +15,7 @@ class AnimatedListFullDefault extends StatefulWidget {
* AnimatedList , * AnimatedList ,
* */ * */
class _AnimatedListFullDefault extends State<AnimatedListFullDefault> { class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
final GlobalKey<AnimatedListState> _listKey = new GlobalKey<AnimatedListState>(); final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
ListModel<int> _list; ListModel<int> _list;
int _selectedItem; int _selectedItem;
int _nextItem; // The next item inserted when the user presses the '+' button. int _nextItem; // The next item inserted when the user presses the '+' button.
@ -26,7 +26,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
if (widget.parent is State) { if (widget.parent is State) {
widget.parent.animatedList = this; // widget.parent.animatedList = this; //
} }
_list = new ListModel<int>( _list = ListModel<int>(
listKey: _listKey, listKey: _listKey,
initialItems: <int>[0, 1, 2], initialItems: <int>[0, 1, 2],
removedItemBuilder: _buildRemovedItem, removedItemBuilder: _buildRemovedItem,
@ -43,14 +43,16 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
void remove() { void remove() {
if (_selectedItem != null) { if (_selectedItem != null) {
_list.removeAt(_list.indexOf(_selectedItem)); _list.removeAt(_list.indexOf(_selectedItem));
setState(() { if(mounted) {
_selectedItem = null; setState(() {
}); _selectedItem = null;
});
}
} }
} }
Widget _buildItem(BuildContext context, int index, Animation<double> animation) { Widget _buildItem(BuildContext context, int index, Animation<double> animation) {
return new CardItem( return CardItem(
animation: animation, animation: animation,
item: _list[index], item: _list[index],
selected: _selectedItem == _list[index], selected: _selectedItem == _list[index],
@ -63,7 +65,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
} }
Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) { Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) {
return new CardItem( return CardItem(
animation: animation, animation: animation,
item: item, item: item,
selected: false, selected: false,
@ -107,20 +109,20 @@ class CardItem extends StatelessWidget {
TextStyle textStyle = Theme.of(context).textTheme.display1; TextStyle textStyle = Theme.of(context).textTheme.display1;
if (selected) if (selected)
textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]); textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]);
return new Padding( return Padding(
padding: const EdgeInsets.all(2.0), padding: const EdgeInsets.all(2.0),
child: new SizeTransition( child: SizeTransition(
axis: Axis.vertical, axis: Axis.vertical,
sizeFactor: animation, sizeFactor: animation,
child: new GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: onTap, onTap: onTap,
child: new SizedBox( child: SizedBox(
height: 128.0, height: 128.0,
child: new Card( child: Card(
color: Colors.primaries[item % Colors.primaries.length], color: Colors.primaries[item % Colors.primaries.length],
child: new Center( child: Center(
child: new Text('Item $item', style: textStyle), child: Text('Item $item', style: textStyle),
), ),
), ),
), ),

View File

@ -58,7 +58,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDemoBoxs(BuildContext context, _DemoState that) { Widget allDemoBoxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -25,7 +25,7 @@ class ListModel<E> {
Iterable<E> initialItems, Iterable<E> initialItems,
}) : assert(listKey != null), }) : assert(listKey != null),
assert(removedItemBuilder != null), assert(removedItemBuilder != null),
_items = new List<E>.from(initialItems ?? <E>[]); _items = List<E>.from(initialItems ?? <E>[]);
final GlobalKey<AnimatedListState> listKey; final GlobalKey<AnimatedListState> listKey;
final dynamic removedItemBuilder; final dynamic removedItemBuilder;

View File

@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -81,7 +81,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -107,7 +107,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
* align的text * align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -36,8 +36,8 @@ class _CheckedPopupMenuItemDemoState extends State<CheckedPopupMenuItemDemo> {
_checkedValues.add(value); _checkedValues.add(value);
} }
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar( SnackBar(
content: new Text('Checked $_checkedValues'))); content: Text('Checked $_checkedValues')));
} }
@override @override

View File

@ -19,8 +19,8 @@ class _PopupMenuButtonDemoState extends State<PopupMenuButtonDemo> {
void showMenuSelection(String value) { void showMenuSelection(String value) {
if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value)) if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value))
_simpleValue = value; _simpleValue = value;
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar( SnackBar(
content: new Text('You selected: $value'))); content: Text('You selected: $value')));
} }

View File

@ -13,7 +13,7 @@ class PopupMenuDividerDemo extends StatefulWidget {
class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> { class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> {
void showInSnackBar(String value) { void showInSnackBar(String value) {
Scaffold.of(context) Scaffold.of(context)
.showSnackBar(new SnackBar(content: new Text('You selected: $value'))); .showSnackBar( SnackBar(content: Text('You selected: $value')));
} }
@override @override

View File

@ -18,7 +18,7 @@ const String content0 = '''
const String content1 = ''' const String content1 = '''
### **基本用法** ### **基本用法**
> 此widget通过调整Divider widget 来适应于弹出菜单中 > 此widget通过调整Divider widget 来适应于弹出菜单中
- 在 PopupMenuButton 中直接 new PopupMenuDivider() 即可 - 在 PopupMenuButton 中直接 PopupMenuDivider() 即可
'''; ''';
class Demo extends StatefulWidget { class Demo extends StatefulWidget {

View File

@ -25,9 +25,11 @@ class _BottomNavigationBarFullDefault extends State {
int _currentIndex = 1; int _currentIndex = 1;
void _onItemTapped(int index) { void _onItemTapped(int index) {
setState(() { if(mounted) {
_currentIndex = index; setState(() {
}); _currentIndex = index;
});
}
} }
@override @override
@ -40,17 +42,17 @@ class _BottomNavigationBarFullDefault extends State {
fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed则通过 fixedColor 设置选中 item 的颜色 fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed则通过 fixedColor 设置选中 item 的颜色
items: <BottomNavigationBarItem> [ items: <BottomNavigationBarItem> [
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("Home"), icon: new Icon(Icons.home)), title: Text("Home"), icon: Icon(Icons.home)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("List"), icon: new Icon(Icons.list)), title: Text("List"), icon: Icon(Icons.list)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("Message"), icon: new Icon(Icons.message)), title: Text("Message"), icon: Icon(Icons.message)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("add"), icon: new Icon(Icons.add)), title: Text("add"), icon: Icon(Icons.add)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("menu"), icon: new Icon(Icons.menu)), title: Text("menu"), icon: Icon(Icons.menu)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("other"), icon: new Icon(Icons.devices_other)), title: Text("other"), icon: Icon(Icons.devices_other)),
], ],
); );

View File

@ -57,7 +57,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDemoBoxs(BuildContext context, _DemoState that) { Widget allDemoBoxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -79,7 +79,7 @@ Widget allDemoBoxs(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -21,20 +21,20 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SizedBox( return SizedBox(
height: 100, height: 100,
child: Scaffold( child: Scaffold(
bottomNavigationBar: new BottomNavigationBar(items: [ bottomNavigationBar: BottomNavigationBar(items: [
new BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.laptop_chromebook), icon: Icon(Icons.laptop_chromebook),
title: new Text("主页"), title: Text("主页"),
backgroundColor: Colors.red backgroundColor: Colors.red
), ),
new BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.list), title: new Text("分类"),backgroundColor: Colors.grey), icon: Icon(Icons.list), title: Text("分类"),backgroundColor: Colors.grey),
new BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.local_grocery_store), title: new Text("购物车")), icon: Icon(Icons.local_grocery_store), title: Text("购物车")),
new BottomNavigationBarItem(icon: new Icon(Icons.person), title: new Text("我的")) BottomNavigationBarItem(icon: Icon(Icons.person), title: Text("我的"))
], ],
//onTap: onTap, //onTap: onTap,
//currentIndex: page //currentIndex: page
@ -46,13 +46,13 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
//backgroundColor: Colors.grey, //backgroundColor: Colors.grey,
// //
//// body: new PageView( //// body: PageView(
//// ////
//// children: [ //// children: [
//// new Index(), //// Index(),
//// new Classify(), //// Classify(),
//// new Shopping(), //// Shopping(),
//// new Myself() //// Myself()
//// ], //// ],
//// ////
//// controller: pageController, //// controller: pageController,

View File

@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -70,7 +70,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -14,8 +14,8 @@ class DayPickerDemo extends StatefulWidget {
} }
class _DayPickerState extends State<DayPickerDemo> { class _DayPickerState extends State<DayPickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
TimeOfDay _time = new TimeOfDay.now(); TimeOfDay _time = TimeOfDay.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -29,7 +29,7 @@ class _DayPickerState extends State<DayPickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
Future<void> _selectTime(BuildContext context) async { Future<void> _selectTime(BuildContext context) async {
@ -40,23 +40,23 @@ class _DayPickerState extends State<DayPickerDemo> {
setState(() { setState(() {
_time = picked; _time = picked;
}); });
if (picked == null) _time = new TimeOfDay.now(); if (picked == null) _time = TimeOfDay.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },
), ),
new Text('时间选择'), Text('时间选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_time.toString()}'), child: Text('date selected:${_time.toString()}'),
onPressed: () { onPressed: () {
_selectTime(context); _selectTime(context);
}, },

View File

@ -14,7 +14,7 @@ class MothPickerDemo extends StatefulWidget {
} }
class _MothPickerState extends State<MothPickerDemo> { class _MothPickerState extends State<MothPickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -28,16 +28,16 @@ class _MothPickerState extends State<MothPickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },

View File

@ -14,8 +14,8 @@ class ShowDatePickerDemo extends StatefulWidget {
} }
class _ShowDatePickerState extends State<ShowDatePickerDemo> { class _ShowDatePickerState extends State<ShowDatePickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
TimeOfDay _time = new TimeOfDay.now(); TimeOfDay _time = TimeOfDay.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -29,7 +29,7 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
Future<void> _selectTime(BuildContext context) async { Future<void> _selectTime(BuildContext context) async {
@ -40,23 +40,23 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
setState(() { setState(() {
_time = picked; _time = picked;
}); });
if (picked == null) _time = new TimeOfDay.now(); if (picked == null) _time = TimeOfDay.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },
), ),
new Text('时间选择'), Text('时间选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_time.toString()}'), child: Text('date selected:${_time.toString()}'),
onPressed: () { onPressed: () {
_selectTime(context); _selectTime(context);
}, },

View File

@ -14,7 +14,7 @@ class YearPickerDemo extends StatefulWidget {
} }
class _YearPickerDemoState extends State<YearPickerDemo> { class _YearPickerDemoState extends State<YearPickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -28,16 +28,16 @@ class _YearPickerDemoState extends State<YearPickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },

View File

@ -37,9 +37,9 @@ class _ScaffoldDemo extends State with SingleTickerProviderStateMixin {
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child: new Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Sample Code'), title: Text('Sample Code'),
), ),

View File

@ -56,7 +56,7 @@ class _DemoState extends State<Demo> {
codeUrl: 'components/Scaffold/Scaffold/demo.dart', codeUrl: 'components/Scaffold/Scaffold/demo.dart',
contentList: [ contentList: [
_Text0, _Text0,
new ScaffoldDemo(), ScaffoldDemo(),
], ],
docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html', docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html',
); );

View File

@ -28,9 +28,9 @@ class _ScaffoldStateDemo extends State with SingleTickerProviderStateMixin {
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child:new Scaffold( child: Scaffold(
key:_scaffoldKey, key:_scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: Text('ScaffoldState Demo'), title: Text('ScaffoldState Demo'),

View File

@ -11,7 +11,7 @@ class ScrollPhysicsDemo extends StatefulWidget {
} }
class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> { class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> {
final PageController _pageController = new PageController(); final PageController _pageController = PageController();
double _currentPage = 0.0; double _currentPage = 0.0;
@override @override
@ -54,21 +54,21 @@ class _SimplePage extends StatelessWidget {
final double parallaxOffset; final double parallaxOffset;
@override @override
Widget build(BuildContext context) => new Center( Widget build(BuildContext context) => Center(
child: Container( child: Container(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
child: new Center( child: Center(
child: new Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new Text( Text(
data, data,
style: const TextStyle(fontSize: 60.0,color: Colors.white), style: const TextStyle(fontSize: 60.0,color: Colors.white),
), ),
new SizedBox(height: 40.0), SizedBox(height: 40.0),
new Transform( Transform(
transform: transform:
new Matrix4.translationValues(parallaxOffset, 0.0, 0.0), Matrix4.translationValues(parallaxOffset, 0.0, 0.0),
child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),), child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),),
), ),
], ],

View File

@ -17,15 +17,15 @@ var selectItemValue;
class DropdownButtonDefault extends StatelessWidget { class DropdownButtonDefault extends StatelessWidget {
List<DropdownMenuItem> generateItemList() { List<DropdownMenuItem> generateItemList() {
final List<DropdownMenuItem> items = new List(); final List<DropdownMenuItem> items = List();
final DropdownMenuItem item1 = new DropdownMenuItem( final DropdownMenuItem item1 = DropdownMenuItem(
value: '张三', child: new Text('张三')); value: '张三', child: Text('张三'));
final DropdownMenuItem item2 = new DropdownMenuItem( final DropdownMenuItem item2 = DropdownMenuItem(
value: '李四', child: new Text('李四')); value: '李四', child: Text('李四'));
final DropdownMenuItem item3 = new DropdownMenuItem( final DropdownMenuItem item3 = DropdownMenuItem(
value: '王二', child: new Text('王二')); value: '王二', child: Text('王二'));
final DropdownMenuItem item4 = new DropdownMenuItem( final DropdownMenuItem item4 = DropdownMenuItem(
value: '麻子', child: new Text('麻子')); value: '麻子', child: Text('麻子'));
items.add(item1); items.add(item1);
items.add(item2); items.add(item2);
items.add(item3); items.add(item3);
@ -36,7 +36,7 @@ class DropdownButtonDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DropdownButton( return DropdownButton(
hint: new Text('下拉菜单选择一个人名'), hint: Text('下拉菜单选择一个人名'),
//设置这个value之后,选中对应位置的item //设置这个value之后,选中对应位置的item
//再次呼出下拉菜单会自动定位item位置在当前按钮显示的位置处 //再次呼出下拉菜单会自动定位item位置在当前按钮显示的位置处
value: selectItValue, value: selectItValue,
@ -51,54 +51,54 @@ class DropdownButtonDefault extends StatelessWidget {
} }
List<DropdownMenuItem> getListData(){ List<DropdownMenuItem> getListData(){
List<DropdownMenuItem> items=new List(); List<DropdownMenuItem> items= List();
DropdownMenuItem dropdownMenuItem1=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem1= DropdownMenuItem(
child:new Text('1'), child: Text('1'),
value: '1', value: '1',
); );
items.add(dropdownMenuItem1); items.add(dropdownMenuItem1);
DropdownMenuItem dropdownMenuItem2=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem2= DropdownMenuItem(
child:new Text('2'), child: Text('2'),
value: '2', value: '2',
); );
items.add(dropdownMenuItem2); items.add(dropdownMenuItem2);
DropdownMenuItem dropdownMenuItem3=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem3= DropdownMenuItem(
child:new Text('3'), child: Text('3'),
value: '3', value: '3',
); );
items.add(dropdownMenuItem3); items.add(dropdownMenuItem3);
DropdownMenuItem dropdownMenuItem4=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem4= DropdownMenuItem(
child:new Text('4'), child: Text('4'),
value: '4', value: '4',
); );
items.add(dropdownMenuItem4); items.add(dropdownMenuItem4);
DropdownMenuItem dropdownMenuItem5=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem5= DropdownMenuItem(
child:new Text('5'), child: Text('5'),
value: '5', value: '5',
); );
items.add(dropdownMenuItem5); items.add(dropdownMenuItem5);
DropdownMenuItem dropdownMenuItem6=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem6= DropdownMenuItem(
child:new Text('6'), child: Text('6'),
value: '6', value: '6',
); );
items.add(dropdownMenuItem6); items.add(dropdownMenuItem6);
DropdownMenuItem dropdownMenuItem7=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem7= DropdownMenuItem(
child:new Text('7'), child: Text('7'),
value: '7', value: '7',
); );
items.add(dropdownMenuItem7); items.add(dropdownMenuItem7);
DropdownMenuItem dropdownMenuItem8=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem8= DropdownMenuItem(
child:new Text('8'), child: Text('8'),
value: '8', value: '8',
); );
items.add(dropdownMenuItem8); items.add(dropdownMenuItem8);
DropdownMenuItem dropdownMenuItem9=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem9= DropdownMenuItem(
child:new Text('9'), child: Text('9'),
value: '9', value: '9',
); );
items.add(dropdownMenuItem9); items.add(dropdownMenuItem9);
DropdownMenuItem dropdownMenuItem10=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem10= DropdownMenuItem(
child:new Text('10'), child: Text('10'),
value: '10', value: '10',
); );
items.add(dropdownMenuItem10); items.add(dropdownMenuItem10);
@ -124,9 +124,11 @@ class DropdownButtonCustom extends StatelessWidget {
value: selectItemValue, value: selectItemValue,
//下拉菜单item点击之后的回调 //下拉菜单item点击之后的回调
onChanged: (T){ onChanged: (T){
parent.setState((){ if (parent.mounted) {
selectItemValue = T; parent.setState(() {
}); selectItemValue = T;
});
}
}, },
//设置阴影的高度 //设置阴影的高度
elevation: 24, elevation: 24,

View File

@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDropdownButtons(BuildContext context,_DemoState that){ Widget allDropdownButtons(BuildContext context,_DemoState that){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -87,14 +87,14 @@ Widget allDropdownButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }

View File

@ -101,9 +101,9 @@ class FlatButtonCustom extends StatelessWidget {
splashColor: Colors.deepPurple, splashColor: Colors.deepPurple,
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: new EdgeInsets.only( padding: EdgeInsets.only(
bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
shape: (shape is ShapeBorder) ? shape : new Border.all( shape: (shape is ShapeBorder) ? shape : Border.all(
// 设置边框样式 // 设置边框样式
color: Colors.grey, color: Colors.grey,
width: 2.0, width: 2.0,

View File

@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allFlatButtons(BuildContext context){ Widget allFlatButtons(BuildContext context){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -109,7 +109,7 @@ Widget allFlatButtons(BuildContext context){
flatButton.FlatButtonCustom('危险按钮',Colors.pink), flatButton.FlatButtonCustom('危险按钮',Colors.pink),
SizedBox(height: 10.0), SizedBox(height: 10.0),
flatButton.FlatButtonCustom('点击我试试!', Colors.red, flatButton.FlatButtonCustom('点击我试试!', Colors.red,
new Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid), Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
() => _showMessage('点击了 FLAT BUTTON ', context)), () => _showMessage('点击了 FLAT BUTTON ', context)),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ])
@ -126,16 +126,16 @@ void _showMessage(String name, BuildContext context) {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: new Text('提示'), title: Text('提示'),
content: new Text(name), content: Text(name),
actions: <Widget>[ actions: <Widget>[
new FlatButton( FlatButton(
// alert 的取消按钮 // alert 的取消按钮
onPressed: () { onPressed: () {
// 取消的事件 // 取消的事件
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
child: new Text('取消')) child: Text('取消'))
]); ]);
} }
); );
@ -145,14 +145,14 @@ void _showMessage(String name, BuildContext context) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }

View File

@ -49,7 +49,7 @@ class FloatingActionButtonCustom extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _onPressed = onPressed; final _onPressed = onPressed;
return new FloatingActionButton( return FloatingActionButton(
// 子视图一般为Icon不推荐使用文字 // 子视图一般为Icon不推荐使用文字
child: const Icon(Icons.refresh), child: const Icon(Icons.refresh),
// FAB的文字解释FAB被长按时显示也是无障碍功能 // FAB的文字解释FAB被长按时显示也是无障碍功能
@ -109,8 +109,8 @@ class FloatingActionButtonCustom2 extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
backgroundColor: Colors.amber, backgroundColor: Colors.amber,
//如果不手动设置icon和text颜色,则默认使用foregroundColor颜色 //如果不手动设置icon和text颜色,则默认使用foregroundColor颜色
icon: new Icon(Icons.flag,color: Colors.red), icon: Icon(Icons.flag,color: Colors.red),
label: new Text('FloatingActionButton.extended', maxLines: 1), label: Text('FloatingActionButton.extended', maxLines: 1),
); );
} }
} }

View File

@ -50,9 +50,11 @@ class _DemoState extends State<Demo> {
String buttonShapeType = 'border'; // 边框类型 String buttonShapeType = 'border'; // 边框类型
void setButtonShapeType(){ void setButtonShapeType(){
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
this.setState((){ if(mounted) {
buttonShapeType = _buttonShapeType; this.setState(() {
}); buttonShapeType = _buttonShapeType;
});
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -72,7 +74,7 @@ class _DemoState extends State<Demo> {
Widget allFloatingActionButtons(BuildContext context,_DemoState that){ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -109,16 +111,16 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -128,14 +130,14 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -159,7 +161,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -75,7 +75,7 @@ class IconButtonCustom extends StatelessWidget {
iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小 iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小
// 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚
splashColor: _randomColor(), splashColor: _randomColor(),
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
// 描述按下按钮时将发生的操作的文本 // 描述按下按钮时将发生的操作的文本
tooltip:'这是${ type.codePoint }信息', tooltip:'这是${ type.codePoint }信息',
// IconButton 的点击事件 // IconButton 的点击事件

View File

@ -45,9 +45,11 @@ class _DemoState extends State<Demo> {
String buttonShapeType = 'border'; // 边框类型 String buttonShapeType = 'border'; // 边框类型
void setButtonShapeType(){ void setButtonShapeType(){
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
this.setState((){ if(mounted) {
buttonShapeType = _buttonShapeType; this.setState(() {
}); buttonShapeType = _buttonShapeType;
});
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -66,7 +68,7 @@ class _DemoState extends State<Demo> {
Widget allIconButtons(BuildContext context,_DemoState that){ Widget allIconButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -106,14 +108,14 @@ Widget allIconButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -137,7 +139,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -79,7 +79,7 @@ class OutlineButtonCustom extends StatelessWidget {
// 文本内容 // 文本内容
child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'), child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'),
// 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor // 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor
borderSide:new BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()), borderSide: BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()),
// 按钮颜色 // 按钮颜色
color: _randomColor(), color: _randomColor(),
// 按钮失效时边框颜色 // 按钮失效时边框颜色
@ -100,7 +100,7 @@ class OutlineButtonCustom extends StatelessWidget {
splashColor: _randomColor(), splashColor: _randomColor(),
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
//高亮时候的阴影 //高亮时候的阴影
highlightElevation: 10.0, highlightElevation: 10.0,
shape: shape, // 在Outline 里只能设置圆角,边框用borderSide shape: shape, // 在Outline 里只能设置圆角,边框用borderSide

View File

@ -54,9 +54,11 @@ class _DemoState extends State<Demo> {
String buttonShapeType = 'border'; // 边框类型 String buttonShapeType = 'border'; // 边框类型
void setButtonShapeType(){ void setButtonShapeType(){
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
this.setState((){ if (mounted) {
buttonShapeType = _buttonShapeType; this.setState(() {
}); buttonShapeType = _buttonShapeType;
});
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -75,7 +77,7 @@ class _DemoState extends State<Demo> {
Widget allOutlineButtons(BuildContext context,_DemoState that){ Widget allOutlineButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -136,16 +138,16 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -155,14 +157,14 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -186,7 +188,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -71,8 +71,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
child: Text('点我试试'), child: Text('点我试试'),
onSelected: (String value) {}, onSelected: (String value) {},
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")), PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")) PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
]); ]);
} }
@ -82,8 +82,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
icon: Icon(Icons.menu), icon: Icon(Icons.menu),
onSelected: (String value) {}, onSelected: (String value) {},
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")), PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")) PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
]); ]);
} }
} }
@ -116,10 +116,10 @@ class PopupMenuButtonCustom extends StatelessWidget {
initialValue:selectStr, initialValue:selectStr,
// 按下按钮时调用以创建要在菜单中显示的项目。 // 按下按钮时调用以创建要在菜单中显示的项目。
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")), PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")), PopupMenuItem(value: "选项二的内容", child: Text("选项二")),
new PopupMenuItem(value: "选项三的内容", child: new Text("选项三")), PopupMenuItem(value: "选项三的内容", child: Text("选项三")),
new PopupMenuItem(value: "选项四的内容", child: new Text("选项四")) PopupMenuItem(value: "选项四的内容", child: Text("选项四"))
], ],
// 应用于弹出菜单按钮的偏移量(x,y)。 // 应用于弹出菜单按钮的偏移量(x,y)。
offset:Offset(0.0,50.0), offset:Offset(0.0,50.0),
@ -134,7 +134,7 @@ class PopupMenuButtonCustom extends StatelessWidget {
}); });
}, },
// 默认情况下匹配IconButton的8 dps填充。在某些情况下特别是在此按钮作为列表项的尾随元素出现的情况下能够将填充设置为零是有用的。 // 默认情况下匹配IconButton的8 dps填充。在某些情况下特别是在此按钮作为列表项的尾随元素出现的情况下能够将填充设置为零是有用的。
padding:new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0), padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0),
//描述按下按钮时将发生的操作的文本。 //描述按下按钮时将发生的操作的文本。
tooltip:'这是信息' tooltip:'这是信息'
); );

View File

@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
Widget allPopupMenuButton(Demo widget,State parent){ Widget allPopupMenuButton(Demo widget,State parent){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -105,10 +105,10 @@ class RaisedButtonCustom extends StatelessWidget {
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: padding:
new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
shape: (shape is ShapeBorder) shape: (shape is ShapeBorder)
? shape ? shape
: new Border.all( : Border.all(
// 设置边框样式 // 设置边框样式
color: Colors.grey, color: Colors.grey,
width: 2.0, width: 2.0,

View File

@ -53,9 +53,11 @@ class _DemoState extends State<Demo> {
String buttonShapeType = 'border'; // 边框类型 String buttonShapeType = 'border'; // 边框类型
void setButtonShapeType(){ void setButtonShapeType(){
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
this.setState((){ if(mounted) {
buttonShapeType = _buttonShapeType; this.setState(() {
}); buttonShapeType = _buttonShapeType;
});
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -74,7 +76,7 @@ class _DemoState extends State<Demo> {
Widget allRaisedButtons(BuildContext context,_DemoState that){ Widget allRaisedButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -135,16 +137,16 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -154,14 +156,14 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -185,7 +187,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -62,7 +62,7 @@ class RawMaterialButtonCustom extends StatelessWidget {
splashColor: _randomColor(), splashColor: _randomColor(),
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
//高亮时候的阴影 //高亮时候的阴影
highlightElevation: 10.0, highlightElevation: 10.0,
// 按钮材质的形状 // 按钮材质的形状

View File

@ -43,9 +43,11 @@ class _DemoState extends State<Demo> {
String buttonShapeType = 'border'; // 边框类型 String buttonShapeType = 'border'; // 边框类型
void setButtonShapeType(){ void setButtonShapeType(){
//String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; //String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
this.setState((){ if( mounted ) {
//buttonShapeType = _buttonShapeType; this.setState(() {
}); //buttonShapeType = _buttonShapeType;
});
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -64,7 +66,7 @@ class _DemoState extends State<Demo> {
Widget allRawMaterialButtons(BuildContext context,_DemoState that){ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -108,16 +110,16 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -127,14 +129,14 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -158,7 +160,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -30,9 +30,11 @@ class _CheckboxDefault extends State {
tristate:false, tristate:false,
value: isChecked, value: isChecked,
onChanged: (bool bol) { onChanged: (bool bol) {
setState((){ if(mounted) {
isChecked = bol; setState(() {
}); isChecked = bol;
});
}
} }
); );
} }
@ -58,9 +60,11 @@ class CheckboxSelect extends StatelessWidget {
tristate:false, tristate:false,
value: parent.selectValue == this.index, value: parent.selectValue == this.index,
onChanged: (bool bol) { onChanged: (bool bol) {
parent.setState((){ if(parent.mounted) {
parent.selectValue = bol ? this.index : -1; parent.setState(() {
}); parent.selectValue = bol ? this.index : -1;
});
}
} }
); );
} }

View File

@ -59,7 +59,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context,_DemoState that){ Widget allCheckboxs(BuildContext context,_DemoState that){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -97,13 +97,13 @@ Widget allCheckboxs(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }

Some files were not shown because too many files have changed in this diff Show More