fix: code conflict
@ -16,7 +16,7 @@ No
|
||||
This Project need latest package, please update regularly.
|
||||
|
||||
- dart(version: 2.0.0)
|
||||
- flutter(version: v1.1.10)
|
||||
- flutter(version: v1.0.0)
|
||||
|
||||
### Background
|
||||
|
||||
|
@ -26,7 +26,7 @@ iphone下载地址:
|
||||
本项目环境持续更新. 请定期更新各依赖包.
|
||||
|
||||
- dart(version: 2.0.0)
|
||||
- flutter(version: v1.1.10)
|
||||
- flutter(version: v1.0.0)
|
||||
|
||||
|
||||
### 背景
|
||||
|
@ -8,6 +8,8 @@ public class MainActivity extends FlutterActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// setContentView(R.layout.activity_main);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
android:src="@mipmap/splash" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
BIN
android/app/src/main/res/drawable/splash.png
Normal file
After Width: | Height: | Size: 197 KiB |
8
android/app/src/main/res/layout/activity_main.xml
Normal 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>
|
BIN
android/app/src/main/res/mipmap-xhdpi/splash.png
Normal file
After Width: | Height: | Size: 197 KiB |
BIN
assets/images/painterImg.jpeg
Normal file
After Width: | Height: | Size: 185 KiB |
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* 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 */; };
|
||||
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
@ -37,6 +38,7 @@
|
||||
/* End PBXCopyFilesBuildPhase 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>"; };
|
||||
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>"; };
|
||||
@ -101,6 +103,7 @@
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
084A20872202E4FD00428FF5 /* flutter go.png */,
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
@ -206,6 +209,7 @@
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
084A20882202E4FD00428FF5 /* flutter go.png in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
@ -445,7 +449,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterRookieBook;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
@ -469,7 +473,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterRookieBook;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
|
@ -7,6 +7,7 @@
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
[GeneratedPluginRegistrant registerWithRegistry:self];
|
||||
// Override point for customization after application launch.
|
||||
[NSThread sleepForTimeInterval:2];
|
||||
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
}
|
||||
|
||||
|
@ -2,17 +2,17 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"filename" : "flutter go.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"filename" : "flutter go-1.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"filename" : "flutter go-2.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
|
Before Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 68 B |
BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-1.png
vendored
Normal file
After Width: | Height: | Size: 197 KiB |
BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-2.png
vendored
Normal file
After Width: | Height: | Size: 197 KiB |
BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go.png
vendored
Normal file
After Width: | Height: | Size: 197 KiB |
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<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">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<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>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@ -14,24 +18,36 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<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"/>
|
||||
<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>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<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 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>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
<point key="canvasLocation" x="84.799999999999997" y="337.33133433283359"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
<image name="LaunchImage" width="1080" height="1920"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
BIN
ios/flutter go.png
Normal file
After Width: | Height: | Size: 197 KiB |
@ -33,12 +33,14 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
|
||||
void refs(bool value) async {
|
||||
final SharedPreferences prefs = await _prefs;
|
||||
final bool unKnow = value;
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_unKnow = prefs.setBool("disclaimer::Boolean", unKnow).then((bool success) {
|
||||
return unKnow;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -135,12 +137,12 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
|
||||
tristate: false,
|
||||
value: _valBool,
|
||||
onChanged: (bool bol) {
|
||||
if(mounted) {
|
||||
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
|
||||
}),
|
||||
Text('不再自动提示', style: TextStyle(fontSize: 14)),
|
||||
|
@ -20,6 +20,7 @@ class _FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
print('widget.filePath=======${widget.filePath}');
|
||||
getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context))
|
||||
.then<void>((String code) {
|
||||
if (mounted) {
|
||||
|
@ -61,7 +61,9 @@ class _ListRefreshState extends State<ListRefresh> {
|
||||
Future _getMoreData() async {
|
||||
if (!isLoading && _hasMore) {
|
||||
// 如果上一次异步请求数据完成 同时有数据可以加载
|
||||
if (mounted) {
|
||||
setState(() => isLoading = true);
|
||||
}
|
||||
//if(_hasMore){ // 还有数据可以拉新
|
||||
List newEntries = await mokeHttpRequest();
|
||||
//if (newEntries.isEmpty) {
|
||||
|
@ -4,10 +4,13 @@ import 'package:flutter/rendering.dart';
|
||||
import 'routers/routers.dart';
|
||||
import 'routers/application.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';
|
||||
|
||||
const int ThemeColor = 0xFFC91B3A;
|
||||
SpUtil sp;
|
||||
var db;
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
MyApp() {
|
||||
@ -15,9 +18,17 @@ class MyApp extends StatelessWidget {
|
||||
Routes.configureRoutes(router);
|
||||
Application.router = router;
|
||||
}
|
||||
|
||||
showWelcomePage() {
|
||||
bool showWelcome = sp.getBool(sharedPreferencesKeys.showWelcome);
|
||||
if (showWelcome == null || showWelcome == true) {
|
||||
return WelcomePage();
|
||||
} else {
|
||||
return AppPage();
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
showWelcomePage();
|
||||
return new MaterialApp(
|
||||
title: 'title',
|
||||
theme: new ThemeData(
|
||||
@ -34,18 +45,18 @@ class MyApp extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
home: new Scaffold(
|
||||
body: new WelcomePage(),
|
||||
body: showWelcomePage()
|
||||
),
|
||||
onGenerateRoute: Application.router.generator,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var db;
|
||||
|
||||
void main() async {
|
||||
final provider = new Provider();
|
||||
await provider.init(true);
|
||||
sp = await SpUtil.getInstance();
|
||||
db = Provider.db;
|
||||
runApp(new MyApp());
|
||||
}
|
||||
|
30
lib/resources/shared_preferences_keys.dart
Normal 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';
|
||||
}
|
||||
|
@ -78,6 +78,9 @@ class WidgetName2Icon {
|
||||
"IconData":Icons.date_range,
|
||||
"IconThemeData":Icons.insert_comment,
|
||||
"Canvas":Icons.edit,
|
||||
"PainterPath":Icons.gesture,
|
||||
"CircleProgressBarPainter":Icons.av_timer,
|
||||
"PainterSketch":Icons.touch_app,
|
||||
"Material":Icons.android,
|
||||
"MaterialApp":Icons.android,
|
||||
"MaterialButton":Icons.speaker,
|
||||
|
@ -1,8 +1,11 @@
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_go/utils/shared_preferences.dart';
|
||||
class Application {
|
||||
static Router router;
|
||||
static TabController controller;
|
||||
static SpUtil sharePeferences;
|
||||
|
||||
static Map<String, String> github = {
|
||||
'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/',
|
||||
|
@ -59,6 +59,7 @@ class Provider {
|
||||
//Get a location using getDatabasesPath
|
||||
String databasesPath = await getDatabasesPath();
|
||||
String path = join(databasesPath, 'flutter.db');
|
||||
print(path);
|
||||
try {
|
||||
db = await openDatabase(path);
|
||||
} catch (e) {
|
||||
|
119
lib/utils/shared_preferences.dart
Normal 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();
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../routers/application.dart';
|
||||
import '../../routers/routers.dart';
|
||||
import '../../utils/shared_preferences.dart';
|
||||
|
||||
final pages = [
|
||||
new PageViewModel(
|
||||
@ -30,7 +31,7 @@ final pages = [
|
||||
class Page extends StatelessWidget {
|
||||
final PageViewModel viewModel;
|
||||
final double percentVisible;
|
||||
|
||||
SpUtil sp;
|
||||
Page({
|
||||
this.viewModel,
|
||||
this.percentVisible = 1.0,
|
||||
@ -43,8 +44,10 @@ class Page extends StatelessWidget {
|
||||
Widget creatButton(
|
||||
BuildContext context, String txt, IconData iconName, String type) {
|
||||
return RaisedButton.icon(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
if (type == 'start') {
|
||||
await SpUtil.getInstance()
|
||||
..putBool(sharedPreferencesKeys.showWelcome, false);
|
||||
_goHomePage(context);
|
||||
} else if (type == 'goGithub') {
|
||||
Application.router.navigateTo(context,
|
||||
|
@ -24,6 +24,7 @@ class FourthPageState extends State<FourthPage> with TickerProviderStateMixin {
|
||||
slideUpdateStream = new StreamController<SlideUpdate>();
|
||||
|
||||
slideUpdateStream.stream.listen((SlideUpdate event) {
|
||||
if(mounted) {
|
||||
setState(() {
|
||||
if (event.updateType == UpdateType.dragging) {
|
||||
slideDirection = event.direction;
|
||||
@ -70,6 +71,7 @@ class FourthPageState extends State<FourthPage> with TickerProviderStateMixin {
|
||||
animatedPageDragger.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ class WidgetNotFound extends StatelessWidget {
|
||||
title: Text("widget not found"),
|
||||
),
|
||||
body: Container(
|
||||
child: new Text("widget not found")
|
||||
child: Text("widget not found")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollViewController = new ScrollController();
|
||||
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
_scrollViewController = ScrollController();
|
||||
_tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
}
|
||||
|
||||
@override
|
||||
@ -46,26 +46,26 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500,
|
||||
child:new AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: new Text('title'),
|
||||
leading: new Icon(Icons.home),
|
||||
child: AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: Text('title'),
|
||||
leading: Icon(Icons.home),
|
||||
backgroundColor: Colors.amber[500],
|
||||
centerTitle: true,
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: new Icon(Icons.add_alarm),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add_alarm),
|
||||
tooltip: 'Add Alarm',
|
||||
onPressed: () {
|
||||
// do nothing
|
||||
}),
|
||||
new PopupMenuButton<String>(
|
||||
PopupMenuButton<String>(
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: "price", child: new Text('Sort by price')),
|
||||
new PopupMenuItem<String>(
|
||||
value: "time", child: new Text('Sort by time')),
|
||||
PopupMenuItem<String>(
|
||||
value: "price", child: Text('Sort by price')),
|
||||
PopupMenuItem<String>(
|
||||
value: "time", child: Text('Sort by time')),
|
||||
],
|
||||
onSelected: (String action) {
|
||||
switch (action) {
|
||||
@ -78,16 +78,16 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
||||
}
|
||||
})
|
||||
],
|
||||
bottom: new TabBar(
|
||||
bottom: TabBar(
|
||||
isScrollable: true,
|
||||
controller: _tabController,
|
||||
tabs: <Widget>[
|
||||
new Tab(text: "Tabs 1"),
|
||||
new Tab(text: "Tabs 2"),
|
||||
new Tab(text: "Tabs 3"),
|
||||
new Tab(text: "Tabs 4"),
|
||||
new Tab(text: "Tabs 5"),
|
||||
new Tab(text: "Tabs 6"),
|
||||
Tab(text: "Tabs 1"),
|
||||
Tab(text: "Tabs 2"),
|
||||
Tab(text: "Tabs 3"),
|
||||
Tab(text: "Tabs 4"),
|
||||
Tab(text: "Tabs 5"),
|
||||
Tab(text: "Tabs 6"),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -107,7 +107,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child:AppBar(
|
||||
title: Text('My Fancy Dress'),
|
||||
|
@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -84,7 +84,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -21,7 +21,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
child: Scaffold(
|
||||
//appBar: AppBar(title: const Text('Bottom App Bar')),
|
||||
|
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -44,9 +44,9 @@ class ButtonBarLessDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: new EdgeInsets.symmetric(vertical: 0.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 0.0),
|
||||
height: 100.0,
|
||||
child: new Scrollbar(child:ListView(
|
||||
child: Scrollbar(child:ListView(
|
||||
scrollDirection: Axis.horizontal, // 水平listView
|
||||
children: <Widget>[
|
||||
ButtonBar(
|
||||
|
@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -44,9 +44,9 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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,
|
||||
child: NestedScrollView(
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
@ -89,7 +89,7 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
||||
// SliverPersistentHeader(
|
||||
// delegate: _SliverAppBarDelegate(
|
||||
// TabBar(
|
||||
// controller: new TabController(length: 2, vsync: this),
|
||||
// controller: TabController(length: 2, vsync: this),
|
||||
// labelColor: Colors.black87,
|
||||
// unselectedLabelColor: Colors.grey,
|
||||
// tabs: [
|
||||
@ -101,10 +101,10 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
||||
];
|
||||
},
|
||||
body: Center(
|
||||
child: new ListView.builder(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return new ListItemWidget(listData[index]);
|
||||
return ListItemWidget(listData[index]);
|
||||
},
|
||||
itemCount: listData.length,
|
||||
),
|
||||
@ -127,10 +127,10 @@ class ListItemWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new InkWell(
|
||||
child: new ListTile(
|
||||
leading: new Icon(listItem.iconData),
|
||||
title: new Text(listItem.title),
|
||||
return InkWell(
|
||||
child: ListTile(
|
||||
leading: Icon(listItem.iconData),
|
||||
title: Text(listItem.title),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -71,7 +71,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -23,15 +23,15 @@ class SnackBarLessDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 当BuildContext在Scaffold之前时,调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决
|
||||
return new Center(
|
||||
child: new Column(
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new GestureDetector(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('这是一个SnackBar, 右侧有SnackBarAction'),
|
||||
final snackBar = SnackBar(
|
||||
content: Text('这是一个SnackBar, 右侧有SnackBarAction'),
|
||||
backgroundColor:Colors.red,
|
||||
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
action: SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
textColor:Colors.black,
|
||||
label: '撤消',
|
||||
onPressed: () {
|
||||
@ -43,19 +43,19 @@ class SnackBarLessDefault extends StatelessWidget {
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
child: new Text('显示SnackBar'),
|
||||
child: Text('显示SnackBar'),
|
||||
),
|
||||
new GestureDetector(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('右侧无SnackBarAction'),
|
||||
final snackBar = SnackBar(
|
||||
content: Text('右侧无SnackBarAction'),
|
||||
backgroundColor:Colors.red,
|
||||
duration:Duration(minutes: 1),// 持续时间
|
||||
//animation,
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
child: new Text('显示无SnackBarAction的SnackBar'),
|
||||
child: Text('显示无SnackBarAction的SnackBar'),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -72,7 +72,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -16,15 +16,15 @@ class SnackBarActionDemo extends StatefulWidget {
|
||||
|
||||
class _Demo extends State<SnackBarActionDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Center(
|
||||
child: new Column(
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new GestureDetector(
|
||||
onTap: () {
|
||||
new RaisedButton(
|
||||
onPressed: () {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'),
|
||||
backgroundColor:Color(0xffc91b3a),
|
||||
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
action: SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
textColor:Colors.white,
|
||||
label: '撤消',
|
||||
onPressed: () {
|
||||
@ -37,10 +37,10 @@ class _Demo extends State<SnackBarActionDemo> {
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
|
||||
child: new Text('点我显示有action的SnackBar'),
|
||||
child: Text('点我显示有action的SnackBar'),
|
||||
),
|
||||
new GestureDetector(
|
||||
onTap: () async {
|
||||
new RaisedButton(
|
||||
onPressed: () async {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('右侧无SnackBarAction, 3秒后消失'),
|
||||
backgroundColor:Color(0xffc91b3a),
|
||||
@ -49,7 +49,7 @@ class _Demo extends State<SnackBarActionDemo> {
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
child: new Text('点我显示无SnackBarAction的SnackBar'),
|
||||
child: Text('点我显示无SnackBarAction的SnackBar'),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -26,8 +26,8 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollViewController = new ScrollController();
|
||||
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
_scrollViewController = ScrollController();
|
||||
_tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
}
|
||||
|
||||
@override
|
||||
@ -42,27 +42,27 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
|
||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500,
|
||||
child:new Scaffold(
|
||||
appBar: new AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: new Text('TabBar'),
|
||||
leading: new Icon(Icons.home),
|
||||
child: Scaffold(
|
||||
appBar: AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: Text('TabBar'),
|
||||
leading: Icon(Icons.home),
|
||||
backgroundColor: Colors.amber[1000],
|
||||
bottom: new TabBar(
|
||||
bottom: TabBar(
|
||||
isScrollable: true,
|
||||
controller: _tabController,
|
||||
tabs: <Widget>[
|
||||
new Tab(text: "Tabs 1"),
|
||||
new Tab(text: "Tabs 2"),
|
||||
new Tab(text: "Tabs 3"),
|
||||
new Tab(text: "Tabs 4"),
|
||||
new Tab(text: "Tabs 5"),
|
||||
new Tab(text: "Tabs 6"),
|
||||
Tab(text: "Tabs 1"),
|
||||
Tab(text: "Tabs 2"),
|
||||
Tab(text: "Tabs 3"),
|
||||
Tab(text: "Tabs 4"),
|
||||
Tab(text: "Tabs 5"),
|
||||
Tab(text: "Tabs 6"),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: new TabBarView(controller: _tabController, children: <Widget>[
|
||||
body: TabBarView(controller: _tabController, children: <Widget>[
|
||||
Text('TabsView 1'),
|
||||
Text('TabsView 2'),
|
||||
Text('TabsView 3'),
|
||||
|
@ -50,9 +50,9 @@ class CardLessDefault extends StatelessWidget {
|
||||
margin:EdgeInsets.all(20.0),
|
||||
// margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距
|
||||
semanticContainer:true, // 表示单个语义容器,还是false表示单个语义节点的集合,接受单个child,但该child可以是Row,Column或其他包含子级列表的widget
|
||||
// shape:new Border.all(
|
||||
// shape: Border.all(
|
||||
// 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)),
|
||||
child: Column( //card里面的子控件
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -19,9 +19,9 @@ class _Demo extends State<AboutDialogDemo> {
|
||||
void showAlertDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => new AboutDialog(
|
||||
builder: (_) => AboutDialog(
|
||||
applicationName: '名称',
|
||||
applicationIcon: new Icon(Icons.ac_unit),
|
||||
applicationIcon: Icon(Icons.ac_unit),
|
||||
applicationVersion: 'V1.0',
|
||||
children: <Widget>[
|
||||
Text('我是一个关于的dialog')
|
||||
@ -29,12 +29,12 @@ class _Demo extends State<AboutDialogDemo> {
|
||||
));
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return new RaisedButton(
|
||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
return RaisedButton(
|
||||
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
//padding
|
||||
child: new Text(
|
||||
child: Text(
|
||||
'show aboutDialog',
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, //textsize
|
||||
color: Colors.white, // textcolor
|
||||
),
|
||||
|
@ -119,12 +119,12 @@ class AlertDialogDemo extends StatelessWidget{
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return new RaisedButton(
|
||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
return RaisedButton(
|
||||
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
//padding
|
||||
child: new Text(
|
||||
child: Text(
|
||||
'点我显示 AlertDialog',
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, //textsize
|
||||
color: Colors.white, // textcolor
|
||||
),
|
||||
|
@ -42,12 +42,12 @@ class _Demo extends State<DialogDemo> {
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return new RaisedButton(
|
||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
return RaisedButton(
|
||||
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
//padding
|
||||
child: new Text(
|
||||
child: Text(
|
||||
'点我显示 Dialog',
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, //textsize
|
||||
color: Colors.white, // textcolor
|
||||
),
|
||||
@ -108,14 +108,14 @@ class _DialogMoreDemo extends State<DialogMoreDemo> {
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
//padding
|
||||
child: new Text(
|
||||
child: Text(
|
||||
'点我显示Dialog',
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, //textsize
|
||||
color: Colors.white, // textcolor
|
||||
),
|
||||
|
@ -20,17 +20,17 @@ class _Demo extends State<SimpleDialogDemo> {
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return new SimpleDialog(
|
||||
title: new Text('选择'),
|
||||
return SimpleDialog(
|
||||
title: Text('选择'),
|
||||
children: <Widget>[
|
||||
new SimpleDialogOption(
|
||||
child: new Text('选项 1'),
|
||||
SimpleDialogOption(
|
||||
child: Text('选项 1'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
new SimpleDialogOption(
|
||||
child: new Text('选项 2'),
|
||||
SimpleDialogOption(
|
||||
child: Text('选项 2'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@ -41,12 +41,12 @@ class _Demo extends State<SimpleDialogDemo> {
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return new RaisedButton(
|
||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
return RaisedButton(
|
||||
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||
//padding
|
||||
child: new Text(
|
||||
child: Text(
|
||||
'show SimpleDialog',
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, //textsize
|
||||
color: Colors.white, // textcolor
|
||||
),
|
||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridPaperDemo> {
|
||||
return Container(
|
||||
height: 400,
|
||||
color: Color(0xffc91b3a),
|
||||
child: new GridView.count(
|
||||
child: GridView.count(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
@ -40,21 +40,21 @@ class _Demo extends State<GridPaperDemo> {
|
||||
),
|
||||
GridPaper(
|
||||
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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
|
||||
return Container(
|
||||
height: 400,
|
||||
color: Color(0xffc91b3a),
|
||||
child: new GridView.count(
|
||||
child: GridView.count(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
@ -36,21 +36,21 @@ class _Demo extends State<GridTileDemo> {
|
||||
),
|
||||
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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
|
||||
return Container(
|
||||
height: 400,
|
||||
color: Color(0xffc91b3a),
|
||||
child: new GridView.count(
|
||||
child: GridView.count(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
|
||||
child: Container(),
|
||||
|
||||
),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
|
||||
return Container(
|
||||
height: 400,
|
||||
color: Color(0xffc91b3a),
|
||||
child: new GridView.count(
|
||||
child: GridView.count(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
|
||||
child: Container(),
|
||||
|
||||
),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
new 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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
@ -17,34 +17,34 @@ class SliverGridDemo extends StatefulWidget {
|
||||
class _Demo extends State<SliverGridDemo> {
|
||||
|
||||
Widget showCustomScrollView() {
|
||||
return new CustomScrollView(
|
||||
return CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
new SliverGrid(
|
||||
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: 200.0,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: 4.0,
|
||||
),
|
||||
delegate: new SliverChildBuilderDelegate(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return new Container(
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.cyan[100 * (index % 5)],
|
||||
child: new Text('grid item $index'),
|
||||
child: Text('grid item $index'),
|
||||
);
|
||||
},
|
||||
childCount: 20,
|
||||
),
|
||||
),
|
||||
// new SliverFixedExtentList(
|
||||
// SliverFixedExtentList(
|
||||
// itemExtent: 100.0,
|
||||
// delegate: new SliverChildBuilderDelegate(
|
||||
// delegate: SliverChildBuilderDelegate(
|
||||
// (BuildContext context, int index) {
|
||||
// return new Container(
|
||||
// return Container(
|
||||
// alignment: Alignment.center,
|
||||
// color: Colors.lightBlue[100 * (index % 9)],
|
||||
// child: new Text('list item $index'),
|
||||
// child: Text('list item $index'),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
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 {
|
||||
AnimatedListFullDefault({Key key, this.parent}) : super(key: key);
|
||||
@ -15,7 +15,7 @@ class AnimatedListFullDefault extends StatefulWidget {
|
||||
* AnimatedList 默认的实例,有状态
|
||||
* */
|
||||
class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
||||
final GlobalKey<AnimatedListState> _listKey = new GlobalKey<AnimatedListState>();
|
||||
final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
|
||||
ListModel<int> _list;
|
||||
int _selectedItem;
|
||||
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) {
|
||||
widget.parent.animatedList = this; // 修改父级的对象引用
|
||||
}
|
||||
_list = new ListModel<int>(
|
||||
_list = ListModel<int>(
|
||||
listKey: _listKey,
|
||||
initialItems: <int>[0, 1, 2],
|
||||
removedItemBuilder: _buildRemovedItem,
|
||||
@ -43,14 +43,16 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
||||
void remove() {
|
||||
if (_selectedItem != null) {
|
||||
_list.removeAt(_list.indexOf(_selectedItem));
|
||||
if(mounted) {
|
||||
setState(() {
|
||||
_selectedItem = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildItem(BuildContext context, int index, Animation<double> animation) {
|
||||
return new CardItem(
|
||||
return CardItem(
|
||||
animation: animation,
|
||||
item: _list[index],
|
||||
selected: _selectedItem == _list[index],
|
||||
@ -63,7 +65,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
||||
}
|
||||
|
||||
Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) {
|
||||
return new CardItem(
|
||||
return CardItem(
|
||||
animation: animation,
|
||||
item: item,
|
||||
selected: false,
|
||||
@ -107,20 +109,20 @@ class CardItem extends StatelessWidget {
|
||||
TextStyle textStyle = Theme.of(context).textTheme.display1;
|
||||
if (selected)
|
||||
textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]);
|
||||
return new Padding(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: new SizeTransition(
|
||||
child: SizeTransition(
|
||||
axis: Axis.vertical,
|
||||
sizeFactor: animation,
|
||||
child: new GestureDetector(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onTap,
|
||||
child: new SizedBox(
|
||||
child: SizedBox(
|
||||
height: 128.0,
|
||||
child: new Card(
|
||||
child: Card(
|
||||
color: Colors.primaries[item % Colors.primaries.length],
|
||||
child: new Center(
|
||||
child: new Text('Item $item', style: textStyle),
|
||||
child: Center(
|
||||
child: Text('Item $item', style: textStyle),
|
||||
),
|
||||
),
|
||||
),
|
@ -58,7 +58,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
@ -25,7 +25,7 @@ class ListModel<E> {
|
||||
Iterable<E> initialItems,
|
||||
}) : assert(listKey != null),
|
||||
assert(removedItemBuilder != null),
|
||||
_items = new List<E>.from(initialItems ?? <E>[]);
|
||||
_items = List<E>.from(initialItems ?? <E>[]);
|
||||
|
||||
final GlobalKey<AnimatedListState> listKey;
|
||||
final dynamic removedItemBuilder;
|
@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
@ -81,7 +81,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -107,7 +107,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
@ -36,8 +36,8 @@ class _CheckedPopupMenuItemDemoState extends State<CheckedPopupMenuItemDemo> {
|
||||
_checkedValues.add(value);
|
||||
}
|
||||
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text('Checked $_checkedValues')));
|
||||
Scaffold.of(context).showSnackBar( SnackBar(
|
||||
content: Text('Checked $_checkedValues')));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -19,8 +19,8 @@ class _PopupMenuButtonDemoState extends State<PopupMenuButtonDemo> {
|
||||
void showMenuSelection(String value) {
|
||||
if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value))
|
||||
_simpleValue = value;
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text('You selected: $value')));
|
||||
Scaffold.of(context).showSnackBar( SnackBar(
|
||||
content: Text('You selected: $value')));
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ class PopupMenuDividerDemo extends StatefulWidget {
|
||||
class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> {
|
||||
void showInSnackBar(String value) {
|
||||
Scaffold.of(context)
|
||||
.showSnackBar(new SnackBar(content: new Text('You selected: $value')));
|
||||
.showSnackBar( SnackBar(content: Text('You selected: $value')));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -18,7 +18,7 @@ const String content0 = '''
|
||||
const String content1 = '''
|
||||
### **基本用法**
|
||||
> 此widget通过调整Divider widget 来适应于弹出菜单中
|
||||
- 在 PopupMenuButton 中直接 new PopupMenuDivider() 即可
|
||||
- 在 PopupMenuButton 中直接 PopupMenuDivider() 即可
|
||||
''';
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
|
@ -25,10 +25,12 @@ class _BottomNavigationBarFullDefault extends State {
|
||||
int _currentIndex = 1;
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
if(mounted) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -40,17 +42,17 @@ class _BottomNavigationBarFullDefault extends State {
|
||||
fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed,则通过 fixedColor 设置选中 item 的颜色
|
||||
items: <BottomNavigationBarItem> [
|
||||
BottomNavigationBarItem(
|
||||
title: new Text("Home"), icon: new Icon(Icons.home)),
|
||||
title: Text("Home"), icon: Icon(Icons.home)),
|
||||
BottomNavigationBarItem(
|
||||
title: new Text("List"), icon: new Icon(Icons.list)),
|
||||
title: Text("List"), icon: Icon(Icons.list)),
|
||||
BottomNavigationBarItem(
|
||||
title: new Text("Message"), icon: new Icon(Icons.message)),
|
||||
title: Text("Message"), icon: Icon(Icons.message)),
|
||||
BottomNavigationBarItem(
|
||||
title: new Text("add"), icon: new Icon(Icons.add)),
|
||||
title: Text("add"), icon: Icon(Icons.add)),
|
||||
BottomNavigationBarItem(
|
||||
title: new Text("menu"), icon: new Icon(Icons.menu)),
|
||||
title: Text("menu"), icon: Icon(Icons.menu)),
|
||||
BottomNavigationBarItem(
|
||||
title: new Text("other"), icon: new Icon(Icons.devices_other)),
|
||||
title: Text("other"), icon: Icon(Icons.devices_other)),
|
||||
|
||||
],
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -79,7 +79,7 @@ Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -21,20 +21,20 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
child: Scaffold(
|
||||
bottomNavigationBar: new BottomNavigationBar(items: [
|
||||
new BottomNavigationBarItem(
|
||||
icon: new Icon(Icons.laptop_chromebook),
|
||||
title: new Text("主页"),
|
||||
bottomNavigationBar: BottomNavigationBar(items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.laptop_chromebook),
|
||||
title: Text("主页"),
|
||||
backgroundColor: Colors.red
|
||||
),
|
||||
new BottomNavigationBarItem(
|
||||
icon: new Icon(Icons.list), title: new Text("分类"),backgroundColor: Colors.grey),
|
||||
new BottomNavigationBarItem(
|
||||
icon: new Icon(Icons.local_grocery_store), title: new Text("购物车")),
|
||||
new BottomNavigationBarItem(icon: new Icon(Icons.person), title: new Text("我的"))
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.list), title: Text("分类"),backgroundColor: Colors.grey),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.local_grocery_store), title: Text("购物车")),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.person), title: Text("我的"))
|
||||
],
|
||||
//onTap: onTap,
|
||||
//currentIndex: page
|
||||
@ -46,13 +46,13 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
|
||||
|
||||
//backgroundColor: Colors.grey,
|
||||
//
|
||||
//// body: new PageView(
|
||||
//// body: PageView(
|
||||
////
|
||||
//// children: [
|
||||
//// new Index(),
|
||||
//// new Classify(),
|
||||
//// new Shopping(),
|
||||
//// new Myself()
|
||||
//// Index(),
|
||||
//// Classify(),
|
||||
//// Shopping(),
|
||||
//// Myself()
|
||||
//// ],
|
||||
////
|
||||
//// controller: pageController,
|
||||
|
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -70,7 +70,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -14,8 +14,8 @@ class DayPickerDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _DayPickerState extends State<DayPickerDemo> {
|
||||
DateTime _date = new DateTime.now();
|
||||
TimeOfDay _time = new TimeOfDay.now();
|
||||
DateTime _date = DateTime.now();
|
||||
TimeOfDay _time = TimeOfDay.now();
|
||||
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime picked = await showDatePicker(
|
||||
@ -29,7 +29,7 @@ class _DayPickerState extends State<DayPickerDemo> {
|
||||
_date = picked;
|
||||
});
|
||||
|
||||
if (picked == null) _date = new DateTime.now();
|
||||
if (picked == null) _date = DateTime.now();
|
||||
}
|
||||
|
||||
Future<void> _selectTime(BuildContext context) async {
|
||||
@ -40,23 +40,23 @@ class _DayPickerState extends State<DayPickerDemo> {
|
||||
setState(() {
|
||||
_time = picked;
|
||||
});
|
||||
if (picked == null) _time = new TimeOfDay.now();
|
||||
if (picked == null) _time = TimeOfDay.now();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new Text('日期选择'),
|
||||
new RaisedButton(
|
||||
child: new Text('date selected:${_date.toString()}'),
|
||||
Text('日期选择'),
|
||||
RaisedButton(
|
||||
child: Text('date selected:${_date.toString()}'),
|
||||
onPressed: () {
|
||||
_selectDate(context);
|
||||
},
|
||||
),
|
||||
new Text('时间选择'),
|
||||
new RaisedButton(
|
||||
child: new Text('date selected:${_time.toString()}'),
|
||||
Text('时间选择'),
|
||||
RaisedButton(
|
||||
child: Text('date selected:${_time.toString()}'),
|
||||
onPressed: () {
|
||||
_selectTime(context);
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ class MothPickerDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MothPickerState extends State<MothPickerDemo> {
|
||||
DateTime _date = new DateTime.now();
|
||||
DateTime _date = DateTime.now();
|
||||
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime picked = await showDatePicker(
|
||||
@ -28,16 +28,16 @@ class _MothPickerState extends State<MothPickerDemo> {
|
||||
_date = picked;
|
||||
});
|
||||
|
||||
if (picked == null) _date = new DateTime.now();
|
||||
if (picked == null) _date = DateTime.now();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new Text('日期选择'),
|
||||
new RaisedButton(
|
||||
child: new Text('date selected:${_date.toString()}'),
|
||||
Text('日期选择'),
|
||||
RaisedButton(
|
||||
child: Text('date selected:${_date.toString()}'),
|
||||
onPressed: () {
|
||||
_selectDate(context);
|
||||
},
|
||||
|
@ -14,8 +14,8 @@ class ShowDatePickerDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
||||
DateTime _date = new DateTime.now();
|
||||
TimeOfDay _time = new TimeOfDay.now();
|
||||
DateTime _date = DateTime.now();
|
||||
TimeOfDay _time = TimeOfDay.now();
|
||||
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime picked = await showDatePicker(
|
||||
@ -29,7 +29,7 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
||||
_date = picked;
|
||||
});
|
||||
|
||||
if (picked == null) _date = new DateTime.now();
|
||||
if (picked == null) _date = DateTime.now();
|
||||
}
|
||||
|
||||
Future<void> _selectTime(BuildContext context) async {
|
||||
@ -40,23 +40,23 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
||||
setState(() {
|
||||
_time = picked;
|
||||
});
|
||||
if (picked == null) _time = new TimeOfDay.now();
|
||||
if (picked == null) _time = TimeOfDay.now();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new Text('日期选择'),
|
||||
new RaisedButton(
|
||||
child: new Text('date selected:${_date.toString()}'),
|
||||
Text('日期选择'),
|
||||
RaisedButton(
|
||||
child: Text('date selected:${_date.toString()}'),
|
||||
onPressed: () {
|
||||
_selectDate(context);
|
||||
},
|
||||
),
|
||||
new Text('时间选择'),
|
||||
new RaisedButton(
|
||||
child: new Text('date selected:${_time.toString()}'),
|
||||
Text('时间选择'),
|
||||
RaisedButton(
|
||||
child: Text('date selected:${_time.toString()}'),
|
||||
onPressed: () {
|
||||
_selectTime(context);
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ class YearPickerDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _YearPickerDemoState extends State<YearPickerDemo> {
|
||||
DateTime _date = new DateTime.now();
|
||||
DateTime _date = DateTime.now();
|
||||
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime picked = await showDatePicker(
|
||||
@ -28,16 +28,16 @@ class _YearPickerDemoState extends State<YearPickerDemo> {
|
||||
_date = picked;
|
||||
});
|
||||
|
||||
if (picked == null) _date = new DateTime.now();
|
||||
if (picked == null) _date = DateTime.now();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new Text('日期选择'),
|
||||
new RaisedButton(
|
||||
child: new Text('date selected:${_date.toString()}'),
|
||||
Text('日期选择'),
|
||||
RaisedButton(
|
||||
child: Text('date selected:${_date.toString()}'),
|
||||
onPressed: () {
|
||||
_selectDate(context);
|
||||
},
|
||||
|
@ -37,9 +37,9 @@ class _ScaffoldDemo extends State with SingleTickerProviderStateMixin {
|
||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500,
|
||||
child: new Scaffold(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Sample Code'),
|
||||
),
|
||||
|
@ -56,7 +56,7 @@ class _DemoState extends State<Demo> {
|
||||
codeUrl: 'components/Scaffold/Scaffold/demo.dart',
|
||||
contentList: [
|
||||
_Text0,
|
||||
new ScaffoldDemo(),
|
||||
ScaffoldDemo(),
|
||||
],
|
||||
docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html',
|
||||
);
|
||||
|
@ -28,9 +28,9 @@ class _ScaffoldStateDemo extends State with SingleTickerProviderStateMixin {
|
||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500,
|
||||
child:new Scaffold(
|
||||
child: Scaffold(
|
||||
key:_scaffoldKey,
|
||||
appBar: AppBar(
|
||||
title: Text('ScaffoldState Demo'),
|
||||
|
@ -11,7 +11,7 @@ class ScrollPhysicsDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> {
|
||||
final PageController _pageController = new PageController();
|
||||
final PageController _pageController = PageController();
|
||||
double _currentPage = 0.0;
|
||||
|
||||
@override
|
||||
@ -54,21 +54,21 @@ class _SimplePage extends StatelessWidget {
|
||||
final double parallaxOffset;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => new Center(
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: Container(
|
||||
color: Theme.of(context).primaryColor,
|
||||
child: new Center(
|
||||
child: new Column(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
Text(
|
||||
data,
|
||||
style: const TextStyle(fontSize: 60.0,color: Colors.white),
|
||||
),
|
||||
new SizedBox(height: 40.0),
|
||||
new Transform(
|
||||
SizedBox(height: 40.0),
|
||||
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),),
|
||||
),
|
||||
],
|
||||
|
@ -17,15 +17,15 @@ var selectItemValue;
|
||||
|
||||
class DropdownButtonDefault extends StatelessWidget {
|
||||
List<DropdownMenuItem> generateItemList() {
|
||||
final List<DropdownMenuItem> items = new List();
|
||||
final DropdownMenuItem item1 = new DropdownMenuItem(
|
||||
value: '张三', child: new Text('张三'));
|
||||
final DropdownMenuItem item2 = new DropdownMenuItem(
|
||||
value: '李四', child: new Text('李四'));
|
||||
final DropdownMenuItem item3 = new DropdownMenuItem(
|
||||
value: '王二', child: new Text('王二'));
|
||||
final DropdownMenuItem item4 = new DropdownMenuItem(
|
||||
value: '麻子', child: new Text('麻子'));
|
||||
final List<DropdownMenuItem> items = List();
|
||||
final DropdownMenuItem item1 = DropdownMenuItem(
|
||||
value: '张三', child: Text('张三'));
|
||||
final DropdownMenuItem item2 = DropdownMenuItem(
|
||||
value: '李四', child: Text('李四'));
|
||||
final DropdownMenuItem item3 = DropdownMenuItem(
|
||||
value: '王二', child: Text('王二'));
|
||||
final DropdownMenuItem item4 = DropdownMenuItem(
|
||||
value: '麻子', child: Text('麻子'));
|
||||
items.add(item1);
|
||||
items.add(item2);
|
||||
items.add(item3);
|
||||
@ -36,7 +36,7 @@ class DropdownButtonDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButton(
|
||||
hint: new Text('下拉菜单选择一个人名'),
|
||||
hint: Text('下拉菜单选择一个人名'),
|
||||
//设置这个value之后,选中对应位置的item,
|
||||
//再次呼出下拉菜单,会自动定位item位置在当前按钮显示的位置处
|
||||
value: selectItValue,
|
||||
@ -51,54 +51,54 @@ class DropdownButtonDefault extends StatelessWidget {
|
||||
}
|
||||
|
||||
List<DropdownMenuItem> getListData(){
|
||||
List<DropdownMenuItem> items=new List();
|
||||
DropdownMenuItem dropdownMenuItem1=new DropdownMenuItem(
|
||||
child:new Text('1'),
|
||||
List<DropdownMenuItem> items= List();
|
||||
DropdownMenuItem dropdownMenuItem1= DropdownMenuItem(
|
||||
child: Text('1'),
|
||||
value: '1',
|
||||
);
|
||||
items.add(dropdownMenuItem1);
|
||||
DropdownMenuItem dropdownMenuItem2=new DropdownMenuItem(
|
||||
child:new Text('2'),
|
||||
DropdownMenuItem dropdownMenuItem2= DropdownMenuItem(
|
||||
child: Text('2'),
|
||||
value: '2',
|
||||
);
|
||||
items.add(dropdownMenuItem2);
|
||||
DropdownMenuItem dropdownMenuItem3=new DropdownMenuItem(
|
||||
child:new Text('3'),
|
||||
DropdownMenuItem dropdownMenuItem3= DropdownMenuItem(
|
||||
child: Text('3'),
|
||||
value: '3',
|
||||
);
|
||||
items.add(dropdownMenuItem3);
|
||||
DropdownMenuItem dropdownMenuItem4=new DropdownMenuItem(
|
||||
child:new Text('4'),
|
||||
DropdownMenuItem dropdownMenuItem4= DropdownMenuItem(
|
||||
child: Text('4'),
|
||||
value: '4',
|
||||
);
|
||||
items.add(dropdownMenuItem4);
|
||||
DropdownMenuItem dropdownMenuItem5=new DropdownMenuItem(
|
||||
child:new Text('5'),
|
||||
DropdownMenuItem dropdownMenuItem5= DropdownMenuItem(
|
||||
child: Text('5'),
|
||||
value: '5',
|
||||
);
|
||||
items.add(dropdownMenuItem5);
|
||||
DropdownMenuItem dropdownMenuItem6=new DropdownMenuItem(
|
||||
child:new Text('6'),
|
||||
DropdownMenuItem dropdownMenuItem6= DropdownMenuItem(
|
||||
child: Text('6'),
|
||||
value: '6',
|
||||
);
|
||||
items.add(dropdownMenuItem6);
|
||||
DropdownMenuItem dropdownMenuItem7=new DropdownMenuItem(
|
||||
child:new Text('7'),
|
||||
DropdownMenuItem dropdownMenuItem7= DropdownMenuItem(
|
||||
child: Text('7'),
|
||||
value: '7',
|
||||
);
|
||||
items.add(dropdownMenuItem7);
|
||||
DropdownMenuItem dropdownMenuItem8=new DropdownMenuItem(
|
||||
child:new Text('8'),
|
||||
DropdownMenuItem dropdownMenuItem8= DropdownMenuItem(
|
||||
child: Text('8'),
|
||||
value: '8',
|
||||
);
|
||||
items.add(dropdownMenuItem8);
|
||||
DropdownMenuItem dropdownMenuItem9=new DropdownMenuItem(
|
||||
child:new Text('9'),
|
||||
DropdownMenuItem dropdownMenuItem9= DropdownMenuItem(
|
||||
child: Text('9'),
|
||||
value: '9',
|
||||
);
|
||||
items.add(dropdownMenuItem9);
|
||||
DropdownMenuItem dropdownMenuItem10=new DropdownMenuItem(
|
||||
child:new Text('10'),
|
||||
DropdownMenuItem dropdownMenuItem10= DropdownMenuItem(
|
||||
child: Text('10'),
|
||||
value: '10',
|
||||
);
|
||||
items.add(dropdownMenuItem10);
|
||||
@ -124,9 +124,11 @@ class DropdownButtonCustom extends StatelessWidget {
|
||||
value: selectItemValue,
|
||||
//下拉菜单item点击之后的回调
|
||||
onChanged: (T){
|
||||
if (parent.mounted) {
|
||||
parent.setState(() {
|
||||
selectItemValue = T;
|
||||
});
|
||||
}
|
||||
},
|
||||
//设置阴影的高度
|
||||
elevation: 24,
|
||||
|
@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDropdownButtons(BuildContext context,_DemoState that){
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -87,14 +87,14 @@ Widget allDropdownButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -101,9 +101,9 @@ class FlatButtonCustom extends StatelessWidget {
|
||||
splashColor: Colors.deepPurple,
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: new EdgeInsets.only(
|
||||
padding: EdgeInsets.only(
|
||||
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,
|
||||
width: 2.0,
|
||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allFlatButtons(BuildContext context){
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -109,7 +109,7 @@ Widget allFlatButtons(BuildContext context){
|
||||
flatButton.FlatButtonCustom('危险按钮',Colors.pink),
|
||||
SizedBox(height: 10.0),
|
||||
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)),
|
||||
SizedBox(height: 20.0)
|
||||
])
|
||||
@ -126,16 +126,16 @@ void _showMessage(String name, BuildContext context) {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: new Text('提示'),
|
||||
content: new Text(name),
|
||||
title: Text('提示'),
|
||||
content: Text(name),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
FlatButton(
|
||||
// alert 的取消按钮
|
||||
onPressed: () {
|
||||
// 取消的事件
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: new Text('取消'))
|
||||
child: Text('取消'))
|
||||
]);
|
||||
}
|
||||
);
|
||||
@ -145,14 +145,14 @@ void _showMessage(String name, BuildContext context) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class FloatingActionButtonCustom extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _onPressed = onPressed;
|
||||
return new FloatingActionButton(
|
||||
return FloatingActionButton(
|
||||
// 子视图,一般为Icon,不推荐使用文字
|
||||
child: const Icon(Icons.refresh),
|
||||
// FAB的文字解释,FAB被长按时显示,也是无障碍功能
|
||||
@ -109,8 +109,8 @@ class FloatingActionButtonCustom2 extends StatelessWidget {
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Colors.amber,
|
||||
//如果不手动设置icon和text颜色,则默认使用foregroundColor颜色
|
||||
icon: new Icon(Icons.flag,color: Colors.red),
|
||||
label: new Text('FloatingActionButton.extended', maxLines: 1),
|
||||
icon: Icon(Icons.flag,color: Colors.red),
|
||||
label: Text('FloatingActionButton.extended', maxLines: 1),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -50,10 +50,12 @@ class _DemoState extends State<Demo> {
|
||||
String buttonShapeType = 'border'; // 边框类型
|
||||
void setButtonShapeType(){
|
||||
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
|
||||
if(mounted) {
|
||||
this.setState(() {
|
||||
buttonShapeType = _buttonShapeType;
|
||||
});
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
@ -72,7 +74,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -109,16 +111,16 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -128,14 +130,14 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -75,7 +75,7 @@ class IconButtonCustom extends StatelessWidget {
|
||||
iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小
|
||||
// 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚
|
||||
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 }信息',
|
||||
// IconButton 的点击事件
|
||||
|
@ -45,10 +45,12 @@ class _DemoState extends State<Demo> {
|
||||
String buttonShapeType = 'border'; // 边框类型
|
||||
void setButtonShapeType(){
|
||||
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
|
||||
if(mounted) {
|
||||
this.setState(() {
|
||||
buttonShapeType = _buttonShapeType;
|
||||
});
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
@ -66,7 +68,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allIconButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -106,14 +108,14 @@ Widget allIconButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -79,7 +79,7 @@ class OutlineButtonCustom extends StatelessWidget {
|
||||
// 文本内容
|
||||
child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'),
|
||||
// 边框的颜色,颜色也可以走主题色 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(),
|
||||
// 按钮失效时边框颜色
|
||||
@ -100,7 +100,7 @@ class OutlineButtonCustom extends StatelessWidget {
|
||||
splashColor: _randomColor(),
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,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,
|
||||
shape: shape, // 在Outline 里只能设置圆角,边框用borderSide
|
||||
|
@ -54,10 +54,12 @@ class _DemoState extends State<Demo> {
|
||||
String buttonShapeType = 'border'; // 边框类型
|
||||
void setButtonShapeType(){
|
||||
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
|
||||
if (mounted) {
|
||||
this.setState(() {
|
||||
buttonShapeType = _buttonShapeType;
|
||||
});
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
@ -75,7 +77,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -136,16 +138,16 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -155,14 +157,14 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -71,8 +71,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
|
||||
child: Text('点我试试'),
|
||||
onSelected: (String value) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二"))
|
||||
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||
PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
|
||||
]);
|
||||
}
|
||||
|
||||
@ -82,8 +82,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
|
||||
icon: Icon(Icons.menu),
|
||||
onSelected: (String value) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二"))
|
||||
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||
PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -116,10 +116,10 @@ class PopupMenuButtonCustom extends StatelessWidget {
|
||||
initialValue:selectStr,
|
||||
// 按下按钮时调用以创建要在菜单中显示的项目。
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")),
|
||||
new PopupMenuItem(value: "选项三的内容", child: new Text("选项三")),
|
||||
new PopupMenuItem(value: "选项四的内容", child: new Text("选项四"))
|
||||
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||
PopupMenuItem(value: "选项二的内容", child: Text("选项二")),
|
||||
PopupMenuItem(value: "选项三的内容", child: Text("选项三")),
|
||||
PopupMenuItem(value: "选项四的内容", child: Text("选项四"))
|
||||
],
|
||||
// 应用于弹出菜单按钮的偏移量(x,y)。
|
||||
offset:Offset(0.0,50.0),
|
||||
@ -134,7 +134,7 @@ class PopupMenuButtonCustom extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
// 默认情况下匹配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:'这是信息'
|
||||
);
|
||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
||||
|
||||
Widget allPopupMenuButton(Demo widget,State parent){
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -105,10 +105,10 @@ class RaisedButtonCustom extends StatelessWidget {
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||
clipBehavior: Clip.antiAlias,
|
||||
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
|
||||
: new Border.all(
|
||||
: Border.all(
|
||||
// 设置边框样式
|
||||
color: Colors.grey,
|
||||
width: 2.0,
|
||||
|
@ -53,10 +53,12 @@ class _DemoState extends State<Demo> {
|
||||
String buttonShapeType = 'border'; // 边框类型
|
||||
void setButtonShapeType(){
|
||||
String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
|
||||
if(mounted) {
|
||||
this.setState(() {
|
||||
buttonShapeType = _buttonShapeType;
|
||||
});
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
@ -74,7 +76,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -135,16 +137,16 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -154,14 +156,14 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -62,7 +62,7 @@ class RawMaterialButtonCustom extends StatelessWidget {
|
||||
splashColor: _randomColor(),
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,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,
|
||||
// 按钮材质的形状
|
||||
|
@ -43,10 +43,12 @@ class _DemoState extends State<Demo> {
|
||||
String buttonShapeType = 'border'; // 边框类型
|
||||
void setButtonShapeType(){
|
||||
//String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border';
|
||||
if( mounted ) {
|
||||
this.setState(() {
|
||||
//buttonShapeType = _buttonShapeType;
|
||||
});
|
||||
}
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
@ -64,7 +66,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -108,16 +110,16 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -127,14 +129,14 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -30,10 +30,12 @@ class _CheckboxDefault extends State {
|
||||
tristate:false,
|
||||
value: isChecked,
|
||||
onChanged: (bool bol) {
|
||||
if(mounted) {
|
||||
setState(() {
|
||||
isChecked = bol;
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -58,10 +60,12 @@ class CheckboxSelect extends StatelessWidget {
|
||||
tristate:false,
|
||||
value: parent.selectValue == this.index,
|
||||
onChanged: (bool bol) {
|
||||
if(parent.mounted) {
|
||||
parent.setState(() {
|
||||
parent.selectValue = bol ? this.index : -1;
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allCheckboxs(BuildContext context,_DemoState that){
|
||||
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(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -97,13 +97,13 @@ Widget allCheckboxs(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
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)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -25,8 +25,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
for (var i = 0; i < isChecks.length; i++) {
|
||||
isChecks[i] = value;
|
||||
}
|
||||
if(mounted) {
|
||||
setState(() => _value = value);
|
||||
}
|
||||
}
|
||||
bool isCheck=false;
|
||||
List<bool> isChecks=[false,false,false,false];
|
||||
@override
|
||||
@ -34,7 +36,7 @@ class _CheckboxListTileStateDefault extends State {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Center(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: _value,
|
||||
selected:true,// 默认文字是否高亮
|
||||
@ -48,22 +50,24 @@ class _CheckboxListTileStateDefault extends State {
|
||||
activeColor: Colors.red, // 选中此复选框时要使用的颜色
|
||||
),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[0],
|
||||
title: new Text('选项1'),
|
||||
title: Text('选项1'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
if(mounted) {
|
||||
setState(() {
|
||||
isChecks[0] = bool;
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[1],
|
||||
title: new Text('选项2'),
|
||||
title: Text('选项2'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
@ -72,10 +76,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
});
|
||||
}),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[2],
|
||||
title: new Text('选项3'),
|
||||
title: Text('选项3'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
@ -84,10 +88,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
});
|
||||
}),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[3],
|
||||
title: new Text('选项4'),
|
||||
title: Text('选项4'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
|