mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-06-20 20:38:33 +08:00
Cupertino 的子项
This commit is contained in:
BIN
assets/fonts/Flamante-Roma-Medium.ttf
Executable file
BIN
assets/fonts/Flamante-Roma-Medium.ttf
Executable file
Binary file not shown.
BIN
assets/fonts/Flamante-Roma-MediumItalic.ttf
Executable file
BIN
assets/fonts/Flamante-Roma-MediumItalic.ttf
Executable file
Binary file not shown.
BIN
assets/fonts/Lato-Bold.ttf
Executable file
BIN
assets/fonts/Lato-Bold.ttf
Executable file
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -145,6 +145,10 @@ class WidgetName2Icon {
|
|||||||
"SimpleDialog":Icons.message,
|
"SimpleDialog":Icons.message,
|
||||||
"ScaffoldState":Icons.local_bar,
|
"ScaffoldState":Icons.local_bar,
|
||||||
"GridTile":Icons.apps,
|
"GridTile":Icons.apps,
|
||||||
"MergeableMaterialItem":Icons.view_list
|
"MergeableMaterialItem":Icons.view_list,
|
||||||
|
"CupertinoApp":Icons.face,
|
||||||
|
"CupertinoButton":Icons.crop_7_5,
|
||||||
|
"CupertinoColors":Icons.color_lens,
|
||||||
|
"CupertinoIcons":Icons.insert_emoticon,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
|
|||||||
final SharedPreferences prefs = await _prefs;
|
final SharedPreferences prefs = await _prefs;
|
||||||
final bool unKnow = value;
|
final bool unKnow = value;
|
||||||
setState(() {
|
setState(() {
|
||||||
_unKnow = prefs.setBool("disclaimer", unKnow).then((bool success) {
|
_unKnow = prefs.setBool("disclaimer::Boolean", unKnow).then((bool success) {
|
||||||
return unKnow;
|
return unKnow;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -46,7 +46,7 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
//获取SharedPreferences 存储结果
|
//获取SharedPreferences 存储结果
|
||||||
_unKnow = _prefs.then((SharedPreferences prefs) {
|
_unKnow = _prefs.then((SharedPreferences prefs) {
|
||||||
return (prefs.getBool('disclaimer') ?? false);
|
return (prefs.getBool('disclaimer::Boolean') ?? false);
|
||||||
});
|
});
|
||||||
_unKnow.then((bool value) {
|
_unKnow.then((bool value) {
|
||||||
_valBool = value;
|
_valBool = value;
|
||||||
|
@ -30,20 +30,22 @@ class FirstPageState extends State<FirstPage> with AutomaticKeepAliveClientMixin
|
|||||||
if (key == null) {
|
if (key == null) {
|
||||||
key = GlobalKey<DisclaimerMsgState>();
|
key = GlobalKey<DisclaimerMsgState>();
|
||||||
//获取sharePre
|
//获取sharePre
|
||||||
_unKnow = _prefs.then((SharedPreferences prefs) {
|
_unKnow = _prefs.then((SharedPreferences prefs) {
|
||||||
return (prefs.getBool('disclaimer') ?? false);
|
return (prefs.getBool('disclaimer::Boolean') ?? false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹
|
* 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹
|
||||||
*/
|
*/
|
||||||
_unKnow.then((bool value) {
|
_unKnow.then((bool value) {
|
||||||
print("==========FirstPageState========_unKnow========${value}");
|
print("==========FirstPageState========_unKnow========${value}");
|
||||||
if (!value) {
|
new Future.delayed(const Duration(seconds: 1),(){
|
||||||
key.currentState.showAlertDialog(context);
|
if (!value) {
|
||||||
}
|
key.currentState.showAlertDialog(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WidgetDemo(
|
return WidgetDemo(
|
||||||
title: 'AppBar',
|
title: 'AppBar',
|
||||||
codeUrl: 'componentss/Bar/AppBar/demo.dart',
|
codeUrl: 'components/Bar/AppBar/demo.dart',
|
||||||
contentList: [allDomes(context, this)],
|
contentList: [allDomes(context, this)],
|
||||||
docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html',
|
docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html',
|
||||||
);
|
);
|
||||||
|
168
lib/widgets/themes/Cupertino/CupertinoApp/demo.dart
Normal file
168
lib/widgets/themes/Cupertino/CupertinoApp/demo.dart
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: ryan
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 上午11:34
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoApp 的示例
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checkbox 默认按钮的实例
|
||||||
|
* index 当前checkbox 的索引值
|
||||||
|
* */
|
||||||
|
class CupertinoAppFullDefault extends StatefulWidget {
|
||||||
|
const CupertinoAppFullDefault() : super();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _CupertinoAppFullDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CupertinoApp 默认的实例,有状态
|
||||||
|
* */
|
||||||
|
class _CupertinoAppFullDefault extends State {
|
||||||
|
|
||||||
|
RouterHandler(setting){
|
||||||
|
//setting.isInitialRoute; bool类型 是否初始路由
|
||||||
|
//setting.name; 要跳转的路由名key
|
||||||
|
return PageRouteBuilder(
|
||||||
|
pageBuilder: (BuildContext context, _, __) {
|
||||||
|
//这里为返回的Widget
|
||||||
|
return HomePage();
|
||||||
|
},
|
||||||
|
opaque: false,
|
||||||
|
//跳转动画
|
||||||
|
transitionDuration: Duration(milliseconds: 200),
|
||||||
|
transitionsBuilder: (___, Animation<double> animation, ____, Widget child) {
|
||||||
|
return FadeTransition(
|
||||||
|
opacity: animation,
|
||||||
|
child: new ScaleTransition(
|
||||||
|
scale: new Tween<double>(begin: 0.5, end: 1.0)
|
||||||
|
.animate(animation),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
//height: 500.0,
|
||||||
|
child: CupertinoApp(
|
||||||
|
title: '这里是标题',// 设备用于识别用户的应用程序的单行描述
|
||||||
|
builder: (BuildContext context,Widget child) { // 当构建一个Widget前调用一般做字体大小,方向,主题颜色等配置
|
||||||
|
//return Container(child:Text('这里是内容1',style:TextStyle(color:Colors.black)));
|
||||||
|
return MediaQuery(
|
||||||
|
//字体大小
|
||||||
|
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.4),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
checkerboardOffscreenLayers:false, // 打开渲染到屏幕外位图的图层的checkerboarding
|
||||||
|
checkerboardRasterCacheImages:false, // 打开光栅缓存图像的检查板。
|
||||||
|
debugShowCheckedModeBanner:true,// 在debug模式下打开一个小“DEBUG”横幅,表示该应用程序处于检查模式
|
||||||
|
color: Colors.red, // 该颜色为程序切换中应用图标背景的颜色,当应用图标背景为透明时
|
||||||
|
// home: HomePage(),// 进入程序后显示的第一个页面,传入的是一个Widget,但实际上这个Widget需要包裹一个Scaffold
|
||||||
|
home: CupertinoPageScaffold(// 进入程序后显示的第一个页面,传入的是一个Widget,但实际上这个Widget需要包裹一个Scaffold
|
||||||
|
navigationBar: CupertinoNavigationBar(
|
||||||
|
leading: Icon(CupertinoIcons.back),
|
||||||
|
middle: Text('Title'),
|
||||||
|
trailing: Icon(CupertinoIcons.share),
|
||||||
|
),
|
||||||
|
child:Container(child:Text('这里是内容',style:TextStyle(color:Colors.black))), // 应用程序默认路由,(Navigator.defaultRouteName,即/)
|
||||||
|
),
|
||||||
|
initialRoute:'/home',// 如果构建了导航器,则显示的第一条路径的名称,初始路由,当用户进入程序时,自动打开对应的路由。(home还是位于一级)传入的是上面routes的key
|
||||||
|
locale:Locale('zh', 'CH'),// 本地化初始值
|
||||||
|
localeResolutionCallback: (local,support){// 区域分辨回调,当传入的是不支持的语种,可以根据这个回调,返回相近,并且支持的语种
|
||||||
|
return const Locale('us','uk');
|
||||||
|
},
|
||||||
|
localizationsDelegates:[], // 本地化委托,用于更改Flutter Widget默认的提示语,按钮text等,返回一个 继承自 LocalizationsDelegate 的对象
|
||||||
|
navigatorKey:GlobalKey(), // 导航主键 GlobalKey<NavigatorState>
|
||||||
|
navigatorObservers: [ // 路由观察器,当调用Navigator的相关方法时,会回调相关的操作
|
||||||
|
MyObserver(),
|
||||||
|
],
|
||||||
|
onGenerateRoute: (setting){ // 当通过Navigation.of(context).pushNamed跳转路由时,在routes查找不到时,会调用该方法
|
||||||
|
RouterHandler(setting);
|
||||||
|
},
|
||||||
|
onGenerateTitle: (context){ // 跟上面的tiitle一样,但含有一个context参数用于做本地化
|
||||||
|
return 'Flutter应用';
|
||||||
|
},
|
||||||
|
onUnknownRoute: (setting){ // 效果跟onGenerateRoute一样调用顺序为onGenerateRoute ==> onUnknownRoute
|
||||||
|
//RouterHandler(setting);
|
||||||
|
},
|
||||||
|
routes: { // 声明程序中有哪个通过Navigation.of(context).pushNamed跳转的路由参数以键值对的形式传递key:路由名字value:对应的Widget
|
||||||
|
'/home':(BuildContext context) => HomePage(),
|
||||||
|
'/home/one':(BuildContext context) => OnePage(),
|
||||||
|
},
|
||||||
|
showPerformanceOverlay:false, // 当为true时应用程序顶部覆盖一层GPU和UI曲线图,可即时查看当前流畅度情况
|
||||||
|
showSemanticsDebugger:false, // 当为true时,打开Widget边框,类似Android开发者模式中显示布局边界
|
||||||
|
supportedLocales:[// 传入支持的语种数组
|
||||||
|
const Locale('uok'),
|
||||||
|
const Locale('meg'),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget homeBuild(BuildContext context) {
|
||||||
|
return CupertinoTabScaffold(
|
||||||
|
tabBar: CupertinoTabBar(
|
||||||
|
backgroundColor: CupertinoColors.white,
|
||||||
|
items: const <BottomNavigationBarItem>[
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: ImageIcon(
|
||||||
|
AssetImage('assets/images/btn_icon_dingyuehao_normal.png')),
|
||||||
|
title: Text('Tab 1'),
|
||||||
|
),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: ImageIcon(
|
||||||
|
AssetImage('assets/images/btn_icon_dingyuehao_normal.png')),
|
||||||
|
title: Text('Tab 2'),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
tabBuilder: (BuildContext context, int index) {
|
||||||
|
return CupertinoPageScaffold(
|
||||||
|
navigationBar: CupertinoNavigationBar(
|
||||||
|
backgroundColor: CupertinoColors.destructiveRed,
|
||||||
|
middle: Text('这里是标题', style: TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
|
child: Center(child: Text('这里是内容', style: TextStyle(color: Colors.black))),
|
||||||
|
backgroundColor: CupertinoColors.extraLightBackgroundGray,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyObserver extends NavigatorObserver{
|
||||||
|
@override
|
||||||
|
void didPush(Route route, Route previousRoute) {
|
||||||
|
// 当调用Navigator.push时回调
|
||||||
|
super.didPush(route, previousRoute);
|
||||||
|
//可通过route.settings获取路由相关内容
|
||||||
|
//route.currentResult获取返回内容
|
||||||
|
print('MyObserver 路由观察器:${route.settings.name}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HomePage extends StatelessWidget{
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context){
|
||||||
|
return Center(child:Text('HomePage',style:TextStyle(color:Colors.black)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OnePage extends StatelessWidget{
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context){
|
||||||
|
return Center(child:Text('OnePage',style:TextStyle(color:Colors.red)));
|
||||||
|
}
|
||||||
|
}
|
53
lib/widgets/themes/Cupertino/CupertinoApp/index.dart
Normal file
53
lib/widgets/themes/Cupertino/CupertinoApp/index.dart
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* @Author: 一凨
|
||||||
|
* @Date: 2018-12-27 16:25:22
|
||||||
|
* @Last Modified by: 一凨
|
||||||
|
* @Last Modified time: 2019-01-07 15:52:45
|
||||||
|
*/
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../../common/widget_demo.dart';
|
||||||
|
import './demo.dart' as demoBox;
|
||||||
|
|
||||||
|
const String content0 = '''
|
||||||
|
### **简介**
|
||||||
|
> Cupertino 苹果设计风格的应用,用于创建 iOS 风格应用的顶层组件( Cupertino 苹果电脑的全球总公司所在地,位于美国旧金山 )
|
||||||
|
- 它包含了 iOS 应用程序,通常需要的许多 widget;
|
||||||
|
- 它的构建于基于 iOS 的 WidgetsApp 特定的默认值,如字体和物理滚动;
|
||||||
|
''';
|
||||||
|
|
||||||
|
const String content1 = '''
|
||||||
|
### **基本用法**
|
||||||
|
> CupertinoApp 的主要特性
|
||||||
|
- top 级别的 Navigator 搜索的配置,需要遵循以下规则优先级
|
||||||
|
- 首先,对于 根路由 "/", 使用 home 属性,前提是 home 属性不为空;
|
||||||
|
- 如果没设置home,则使用 routes 属性,它应用程序的顶级路由表;
|
||||||
|
- 如果 home 和 routes 都没有做有效配置,则调用onGenerateRoute(如果提供),并且返回非null值;
|
||||||
|
- 最后,如果所有其他方法都失败onUnknownRoute被调用;
|
||||||
|
- 如果 home,routes,onGenerateRoute和onUnknownRoute 都为null,并且builder不为null,则不会创建任何Navigator;
|
||||||
|
- 如果配置了顶级 Navigator 的 observer,则可以做 Hero 动画;
|
||||||
|
- 在 Android 上谨慎使用此 widget,因为它可能会产生 Android 用户不同的行为,例如:
|
||||||
|
- 通过反向滑动可以禁用页面;
|
||||||
|
- 滚动到底或者顶,会触发 ios 风格的弹性效果;
|
||||||
|
- 某些苹果字体系列在 Android上 不可用,可能导致未定义的字体提示。
|
||||||
|
''';
|
||||||
|
|
||||||
|
class Demo extends StatefulWidget {
|
||||||
|
static const String routeName = '/themes/Cupertino/CupertinoApp';
|
||||||
|
_DemoState createState() => _DemoState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DemoState extends State<Demo> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetDemo(
|
||||||
|
contentList: [
|
||||||
|
content0,
|
||||||
|
content1,
|
||||||
|
demoBox.CupertinoAppFullDefault()
|
||||||
|
],
|
||||||
|
title: 'CupertinoApp',
|
||||||
|
docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoApp-class.html',
|
||||||
|
codeUrl: '/themes/Cupertino/CupertinoApp/demo.dart',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
41
lib/widgets/themes/Cupertino/CupertinoButton/demo.dart
Normal file
41
lib/widgets/themes/Cupertino/CupertinoButton/demo.dart
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: ryan
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 上午11:34
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoButton 的示例
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checkbox 默认按钮的实例
|
||||||
|
* index 当前checkbox 的索引值
|
||||||
|
* */
|
||||||
|
class CupertinoButtonFullDefault extends StatefulWidget {
|
||||||
|
const CupertinoButtonFullDefault() : super();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _CupertinoButtonFullDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CupertinoButton 默认的实例,有状态
|
||||||
|
* */
|
||||||
|
class _CupertinoButtonFullDefault extends State {
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoButton(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(15.0)),
|
||||||
|
onPressed: () {
|
||||||
|
print('on Pressed!');
|
||||||
|
},
|
||||||
|
pressedOpacity:0.5,// 按下后的按钮不透明度
|
||||||
|
color:CupertinoColors.darkBackgroundGray,
|
||||||
|
child: new Text('CupertinoButton'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
45
lib/widgets/themes/Cupertino/CupertinoButton/index.dart
Normal file
45
lib/widgets/themes/Cupertino/CupertinoButton/index.dart
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: 一晟
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 下午10:57
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoButton 的示例
|
||||||
|
*/
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../../common/widget_demo.dart';
|
||||||
|
import './demo.dart' as demoBox;
|
||||||
|
|
||||||
|
const String content0 = '''
|
||||||
|
### **简介**
|
||||||
|
> ios 风格的 button
|
||||||
|
- 与普通的 button 一样,需要设置 text 或者 icon, 不同的是带有 fades out 效果;
|
||||||
|
- 同时可以设置一个背景颜色;
|
||||||
|
''';
|
||||||
|
|
||||||
|
const String content1 = '''
|
||||||
|
### **基本用法**
|
||||||
|
> CupertinoButton 的一个是示例
|
||||||
|
- 属性基本和 flatButton,raisedButton 类似
|
||||||
|
''';
|
||||||
|
|
||||||
|
class Demo extends StatefulWidget {
|
||||||
|
static const String routeName = '/themes/Cupertino/CupertinoApp';
|
||||||
|
_DemoState createState() => _DemoState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DemoState extends State<Demo> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetDemo(
|
||||||
|
contentList: [
|
||||||
|
content0,
|
||||||
|
content1,
|
||||||
|
demoBox.CupertinoButtonFullDefault()
|
||||||
|
],
|
||||||
|
title: 'CupertinoApp',
|
||||||
|
docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoButton-class.html',
|
||||||
|
codeUrl: '/themes/Cupertino/CupertinoButton/demo.dart',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
51
lib/widgets/themes/Cupertino/CupertinoColors/demo.dart
Normal file
51
lib/widgets/themes/Cupertino/CupertinoColors/demo.dart
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: ryan
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 上午11:34
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoColors 的示例
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checkbox 默认按钮的实例
|
||||||
|
* index 当前checkbox 的索引值
|
||||||
|
* */
|
||||||
|
class CupertinoColorsFullDefault extends StatefulWidget {
|
||||||
|
const CupertinoColorsFullDefault() : super();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _CupertinoColorsFullDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CupertinoColors 默认的实例,有状态
|
||||||
|
* */
|
||||||
|
class _CupertinoColorsFullDefault extends State {
|
||||||
|
|
||||||
|
Widget setColorsView(Cupertino_colors){
|
||||||
|
return Container(
|
||||||
|
width: MediaQuery.of(context).size.width-100,
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child:Text('activeBlue',style:TextStyle(color:Colors.white)),
|
||||||
|
decoration:BoxDecoration(color: Cupertino_colors)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
setColorsView(CupertinoColors.activeBlue),
|
||||||
|
setColorsView(CupertinoColors.activeGreen),
|
||||||
|
setColorsView(CupertinoColors.black),
|
||||||
|
setColorsView(CupertinoColors.destructiveRed),
|
||||||
|
setColorsView(CupertinoColors.inactiveGray),
|
||||||
|
setColorsView(CupertinoColors.lightBackgroundGray),
|
||||||
|
setColorsView(CupertinoColors.white)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
42
lib/widgets/themes/Cupertino/CupertinoColors/index.dart
Normal file
42
lib/widgets/themes/Cupertino/CupertinoColors/index.dart
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: 一晟
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 下午10:57
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoButton 的示例
|
||||||
|
*/
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../../common/widget_demo.dart';
|
||||||
|
import './demo.dart' as demoBox;
|
||||||
|
|
||||||
|
const String content0 = '''
|
||||||
|
### **简介**
|
||||||
|
> iOS平台常用的颜色
|
||||||
|
''';
|
||||||
|
|
||||||
|
const String content1 = '''
|
||||||
|
### **基本用法**
|
||||||
|
> CupertinoColors 的一个是示例
|
||||||
|
''';
|
||||||
|
|
||||||
|
class Demo extends StatefulWidget {
|
||||||
|
static const String routeName = '/themes/Cupertino/CupertinoApp';
|
||||||
|
_DemoState createState() => _DemoState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DemoState extends State<Demo> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetDemo(
|
||||||
|
contentList: [
|
||||||
|
content0,
|
||||||
|
content1,
|
||||||
|
demoBox.CupertinoColorsFullDefault()
|
||||||
|
],
|
||||||
|
title: 'CupertinoApp',
|
||||||
|
docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoColors-class.html',
|
||||||
|
codeUrl: '/themes/Cupertino/CupertinoColor/demo.dart',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
89
lib/widgets/themes/Cupertino/CupertinoIcons/demo.dart
Normal file
89
lib/widgets/themes/Cupertino/CupertinoIcons/demo.dart
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: ryan
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 上午11:34
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoIcons 的示例
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_go/common/icon_names.dart' as icon_names;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checkbox 默认按钮的实例
|
||||||
|
* index 当前checkbox 的索引值
|
||||||
|
* */
|
||||||
|
class CupertinoIconsFullDefault extends StatefulWidget {
|
||||||
|
const CupertinoIconsFullDefault() : super();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _CupertinoIconsFullDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CupertinoIcons 默认的实例,有状态
|
||||||
|
* */
|
||||||
|
class _CupertinoIconsFullDefault extends State {
|
||||||
|
|
||||||
|
final colorsList = [];
|
||||||
|
final List<Widget> widgetList = [];
|
||||||
|
|
||||||
|
Widget rowView(IconData itA,IconData itB){
|
||||||
|
//print('itA=====>${itA.fontPackage}');
|
||||||
|
return Row(
|
||||||
|
//mainAxisSize:MainAxisSize.max,
|
||||||
|
//crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
//mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex:1,
|
||||||
|
child: CupertinoButton(
|
||||||
|
padding: EdgeInsets.only(left: 0),
|
||||||
|
child:FlatButton.icon(
|
||||||
|
label: Text('默认按钮', semanticsLabel: 'Add'),
|
||||||
|
icon:Icon(itA,
|
||||||
|
semanticLabel: 'Add',
|
||||||
|
),
|
||||||
|
onPressed: () { },
|
||||||
|
))),
|
||||||
|
Expanded(
|
||||||
|
flex:1,
|
||||||
|
child: CupertinoButton(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
child:FlatButton.icon(
|
||||||
|
label: Text('默认按钮', semanticsLabel: 'Add'),
|
||||||
|
icon:Icon(itB,
|
||||||
|
semanticLabel: 'Add',
|
||||||
|
),
|
||||||
|
onPressed: () { },
|
||||||
|
))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
final names = icon_names.CupertinoIIconNames.names;
|
||||||
|
for(var i=0;i<names.length-2;i++){
|
||||||
|
if(i%2 == 0){
|
||||||
|
widgetList.add(rowView(names[i],names[i+1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return
|
||||||
|
Align(
|
||||||
|
//alignment: Alignment.center,
|
||||||
|
//width: MediaQuery.of(context).size.width,
|
||||||
|
child:Column(
|
||||||
|
//verticalDirection: VerticalDirection.down,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: widgetList
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
44
lib/widgets/themes/Cupertino/CupertinoIcons/index.dart
Normal file
44
lib/widgets/themes/Cupertino/CupertinoIcons/index.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Created with Android Studio.
|
||||||
|
* User: 一晟
|
||||||
|
* Date: 2019/1/20
|
||||||
|
* Time: 下午10:57
|
||||||
|
* email: zhu.yan@alibaba-inc.com
|
||||||
|
* tartget: CupertinoButton 的示例
|
||||||
|
*/
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../../common/widget_demo.dart';
|
||||||
|
import './demo.dart' as demoBox;
|
||||||
|
|
||||||
|
const String content0 = '''
|
||||||
|
### **简介**
|
||||||
|
> Cupertino图标的标识符
|
||||||
|
- 与Icon类一起使用以显示特定图标;
|
||||||
|
- 请确保cupertino_icons在项目的pubspec.yaml文件中添加依赖项。这可确保CupertinoIcons字体包含在您的应用程序中;
|
||||||
|
''';
|
||||||
|
|
||||||
|
const String content1 = '''
|
||||||
|
### **基本用法**
|
||||||
|
> CupertinoIcons 的一个是示例
|
||||||
|
''';
|
||||||
|
|
||||||
|
class Demo extends StatefulWidget {
|
||||||
|
static const String routeName = '/themes/Cupertino/CupertinoApp';
|
||||||
|
_DemoState createState() => _DemoState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DemoState extends State<Demo> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetDemo(
|
||||||
|
contentList: [
|
||||||
|
content0,
|
||||||
|
content1,
|
||||||
|
demoBox.CupertinoIconsFullDefault()
|
||||||
|
],
|
||||||
|
title: 'CupertinoApp',
|
||||||
|
docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoIcons-class.html',
|
||||||
|
codeUrl: '/themes/Cupertino/CupertinoColor/demo.dart',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
31
lib/widgets/themes/Cupertino/index.dart
Normal file
31
lib/widgets/themes/Cupertino/index.dart
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import "package:flutter/material.dart";
|
||||||
|
import '../../../model/widget.dart';
|
||||||
|
|
||||||
|
import 'CupertinoApp/index.dart' as CupertinoApp;
|
||||||
|
import 'CupertinoButton/index.dart' as CupertinoButton;
|
||||||
|
import 'CupertinoColors/index.dart' as CupertinoColors;
|
||||||
|
import 'CupertinoIcons/index.dart' as CupertinoIcons;
|
||||||
|
|
||||||
|
|
||||||
|
List<WidgetPoint> widgetPoints = [
|
||||||
|
WidgetPoint(
|
||||||
|
name: 'CupertinoIcons',
|
||||||
|
routerName: CupertinoIcons.Demo.routeName,
|
||||||
|
buildRouter: (BuildContext context) => CupertinoIcons.Demo(),
|
||||||
|
),
|
||||||
|
WidgetPoint(
|
||||||
|
name: 'CupertinoColors',
|
||||||
|
routerName: CupertinoColors.Demo.routeName,
|
||||||
|
buildRouter: (BuildContext context) => CupertinoColors.Demo(),
|
||||||
|
),
|
||||||
|
WidgetPoint(
|
||||||
|
name: 'CupertinoButton',
|
||||||
|
routerName: CupertinoButton.Demo.routeName,
|
||||||
|
buildRouter: (BuildContext context) => CupertinoButton.Demo(),
|
||||||
|
),
|
||||||
|
WidgetPoint(
|
||||||
|
name: 'CupertinoApp',
|
||||||
|
routerName: CupertinoApp.Demo.routeName,
|
||||||
|
buildRouter: (BuildContext context) => CupertinoApp.Demo(),
|
||||||
|
),
|
||||||
|
];
|
@ -6,9 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import './Material/index.dart' as Material;
|
import './Material/index.dart' as Material;
|
||||||
|
import './Cupertino/index.dart' as Cupertino;
|
||||||
|
|
||||||
List getWidgets() {
|
List getWidgets() {
|
||||||
List result = [];
|
List result = [];
|
||||||
result.addAll(Material.widgetPoints);
|
result.addAll(Material.widgetPoints);
|
||||||
|
result.addAll(Cupertino.widgetPoints);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
@ -165,10 +165,17 @@ flutter:
|
|||||||
- lib/widgets/themes/Material/MergeableMaterialItem/demo.dart
|
- lib/widgets/themes/Material/MergeableMaterialItem/demo.dart
|
||||||
- assets/app.db
|
- assets/app.db
|
||||||
- assets/images/
|
- assets/images/
|
||||||
|
- assets/fonts/
|
||||||
- lib/common/example_code_parser.dart
|
- lib/common/example_code_parser.dart
|
||||||
- lib/common/syntax_highlighter.dart
|
- lib/common/syntax_highlighter.dart
|
||||||
|
|
||||||
|
fonts:
|
||||||
|
- family: FlamanteRoma
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/Flamante-Roma-Medium.ttf
|
||||||
|
- asset: assets/fonts/Lato-Bold.ttf
|
||||||
|
- asset: assets/fonts/Flamante-Roma-MediumItalic.ttf
|
||||||
|
style: italic
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
# assets:
|
# assets:
|
||||||
|
Reference in New Issue
Block a user