浏览代码
Merge pull request #145 from Unity-Technologies/dev_1.17.5
Merge pull request #145 from Unity-Technologies/dev_1.17.5
upgrade master to uiwidgets_2.0 (preview)/main
GitHub
4 年前
当前提交
84b67d9e
共有 1573 个文件被更改,包括 7008 次插入 和 4943 次删除
-
5.gitignore
-
237README-ZH.md
-
264README.md
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta
-
2Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta
-
16Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs
-
33Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs
-
20Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs
-
16Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs
-
12Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs.meta
-
13Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta
-
15Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs
-
2Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta
-
13Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta
-
47Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs
-
2Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta
-
20Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta
-
81Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs
-
2Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs.meta
-
14Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta
-
37Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/GalleryMain.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/UIWidgetsGallery.asmdef
-
15Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_activity_indicator_demo.cs
-
506Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_alert_demo.cs
-
135Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_buttons_demo.cs
-
552Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs
-
522Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_picker_demo.cs
-
105Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_slider_demo.cs
-
119Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_switch_demo.cs
-
330Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_text_field_demo.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material.meta
-
404Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/backdrop_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/backdrop_demo.cs.meta
-
513Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs.meta
-
114Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_navigation_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_navigation_demo.cs.meta
-
690Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/buttons_demo.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/buttons_demo.cs.meta
-
530Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/cards_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/cards_demo.cs.meta
-
269Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/chip_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/chip_demo.cs.meta
-
185Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/date_and_time_picker_demo.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/date_and_time_picker_demo.cs.meta
-
3Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/modal_bottom_sheet_demo.cs
-
9Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/persistent_bottom_sheet_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/persistent_bottom_sheet_demo.cs.meta
-
19Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/search_demo.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/search_demo.cs.meta
-
2Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/tabs_fab_demo.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine.meta
-
45Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine_demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine_demo.cs.meta
-
11Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery.meta
-
170Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/app.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/app.cs.meta
-
260Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/backdrop.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/backdrop.cs.meta
-
316Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demo.cs
-
4Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demo.cs.meta
-
784Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demos.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demos.cs.meta
-
304Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/home.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/home.cs.meta
-
10Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/icons.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/icons.cs.meta
-
565Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/options.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/options.cs.meta
-
152Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/scales.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/scales.cs.meta
-
64Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/themes.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/themes.cs.meta
-
80Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/updater.cs
-
14Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/updater.cs.meta
-
3Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.asmdef
-
2com.unity.uiwidgets/.editorconfig
-
24com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs
-
22com.unity.uiwidgets/Runtime/animation/animation.cs
-
327com.unity.uiwidgets/Runtime/animation/animation_controller.cs
-
278com.unity.uiwidgets/Runtime/animation/animations.cs
-
526com.unity.uiwidgets/Runtime/animation/curves.cs
-
179com.unity.uiwidgets/Runtime/animation/listener_helpers.mixin.gen.cs
-
40com.unity.uiwidgets/Runtime/animation/listener_helpers.mixin.njk
-
130com.unity.uiwidgets/Runtime/animation/tween.cs
-
71com.unity.uiwidgets/Runtime/async/priority_queue.cs
-
264com.unity.uiwidgets/Runtime/async/timer.cs
-
2com.unity.uiwidgets/Runtime/async/timer.cs.meta
-
2com.unity.uiwidgets/Runtime/cupertino.meta
-
77com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs
-
2com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs.meta
-
144com.unity.uiwidgets/Runtime/cupertino/app.cs
-
2com.unity.uiwidgets/Runtime/cupertino/app.cs.meta
-
158com.unity.uiwidgets/Runtime/cupertino/button.cs
-
2com.unity.uiwidgets/Runtime/cupertino/button.cs.meta
-
769com.unity.uiwidgets/Runtime/cupertino/colors.cs
|
|||
fileFormatVersion: 2 |
|||
guid: 0ae90c343ee0e4f7daf768fe6383340f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: fbf4348f25a14fb7a48fd287e0d01b88 |
|||
timeCreated: 1614220178 |
|
|||
fileFormatVersion: 2 |
|||
fileFormatVersion: 2 |
|||
timeCreated: 1573031753 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1a03d2251d4fb4ef08021dcb11b0dc68 |
|||
timeCreated: 1573031753 |
|||
fileFormatVersion: 2 |
|||
guid: b9e88c33e9f304d40bab9c27f1276033 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: a403bd4bc6da446f1bb8cc0424f2fb85 |
|||
timeCreated: 1573031753 |
|||
fileFormatVersion: 2 |
|||
guid: 0152b6f575e6ca44baea965a23ebe498 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f5061bd7b85f4179a65c68ac289a4a58 |
|||
timeCreated: 1556597371 |
|||
fileFormatVersion: 2 |
|||
guid: b2a39cf0b83823749a13aebaf25cfb1b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 07e8ae972d9945faaef3326486f3a4bf |
|||
timeCreated: 1573031753 |
|||
fileFormatVersion: 2 |
|||
guid: 1cba65c03fbf50f4cac974273a7c9445 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgetsGallery |
|||
{ |
|||
public class GalleryMain : UIWidgetsPanel |
|||
{ |
|||
protected new void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
} |
|||
namespace UIWidgetsGallery { |
|||
public class GalleryMain : UIWidgetsPanel { |
|||
protected override Widget createWidget() { |
|||
return new GalleryApp(); |
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new GalleryApp()); |
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/GalleryIcons"), "GalleryIcons"); |
|||
|
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/CupertinoIcons"), "CupertinoIcons"); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Regular"), ".SF Pro Text", FontWeight.w400); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Semibold"), ".SF Pro Text", FontWeight.w600); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Bold"), ".SF Pro Text", FontWeight.w700); |
|||
|
|||
base.OnEnable(); |
|||
protected override void onEnable() |
|||
{ |
|||
AddFont("Material Icons", new List<string> {"MaterialIcons-Regular.ttf"}, new List<int> {0}); |
|||
AddFont("CupertinoIcons", new List<string> {"CupertinoIcons.ttf"}, new List<int> {0}); |
|||
AddFont("GalleryIcons", new List<string> {"gallery/GalleryIcons.ttf"}, new List<int> {0}); |
|||
} |
|||
} |
|
|||
{ |
|||
"name": "UIWidgetsGallery", |
|||
"references": ["Unity.UIWidgets"], |
|||
"references": [ |
|||
"Unity.UIWidgets" |
|||
], |
|||
"optionalUnityReferences": [], |
|||
"excludePlatforms": [] |
|||
} |
|||
"excludePlatforms": [], |
|||
"allowUnsafeCode": false, |
|||
"overrideReferences": false, |
|||
"precompiledReferences": [], |
|||
"autoReferenced": true, |
|||
"defineConstraints": [] |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.foundation; |
|||
using UnityEngine; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
using Brightness = Unity.UIWidgets.ui.Brightness; |
|||
public static List<string> coolColorNames = new List<string>{ |
|||
"Sarcoline", "Coquelicot", "Smaragdine", "Mikado", "Glaucous", "Wenge", |
|||
"Fulvous", "Xanadu", "Falu", "Eburnean", "Amaranth", "Australien", |
|||
"Banan", "Falu", "Gingerline", "Incarnadine", "Labrador", "Nattier", |
|||
"Pervenche", "Sinoper", "Verditer", "Watchet", "Zaffre", |
|||
}; |
|||
class CupertinoPickerDemo : StatefulWidget { |
|||
public const string routeName = "/cupertino/picker"; |
|||
public class CupertinoPickerDemo : StatefulWidget { |
|||
public const string routeName = "/cupertino/picker"; |
|||
public override State createState() { |
|||
return new _CupertinoPickerDemoState(); |
|||
} |
|||
public override State createState() { |
|||
return new _CupertinoPickerDemoState(); |
|||
} |
|||
|
|||
|
|||
class _CupertinoPickerDemoState : State<CupertinoPickerDemo> { |
|||
int _selectedColorIndex = 0; |
|||
TimeSpan timer = new TimeSpan(); |
|||
|
|||
// Value that is shown in the date picker in date mode.
|
|||
DateTime date = DateTime.Now; |
|||
|
|||
// Value that is shown in the date picker in time mode.
|
|||
DateTime time = DateTime.Now; |
|||
|
|||
// Value that is shown in the date picker in dateAndTime mode.
|
|||
DateTime dateTime = DateTime.Now; |
|||
|
|||
Widget _buildMenu(List<Widget> children) { |
|||
return new Container( |
|||
decoration: new BoxDecoration( |
|||
color: CupertinoTheme.of(this.context).scaffoldBackgroundColor, |
|||
border: new Border( |
|||
top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f), |
|||
bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f) |
|||
) |
|||
), |
|||
height: 44.0f, |
|||
child: new Padding( |
|||
padding: EdgeInsets.symmetric(horizontal: 16.0f), |
|||
child: new SafeArea( |
|||
top: false, |
|||
bottom: false, |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: children |
|||
) |
|||
) |
|||
) |
|||
); |
|||
public class _CupertinoPickerDemoState : State<CupertinoPickerDemo> { |
|||
int _selectedColorIndex = 0; |
|||
TimeSpan timer = new TimeSpan(); |
|||
DateTime date = DateTime.Now; |
|||
DateTime time = DateTime.Now; |
|||
DateTime dateTime = DateTime.Now; |
|||
Widget _buildColorPicker(BuildContext context) { |
|||
FixedExtentScrollController scrollController = new FixedExtentScrollController(initialItem: _selectedColorIndex); |
|||
|
|||
List<Widget> widgets = new List<Widget>(); |
|||
for (int i = 0; i < CupertinoPickerDemoUtils.coolColorNames.Count; i++) |
|||
{ |
|||
widgets.Add(new Center( |
|||
child: new Text(CupertinoPickerDemoUtils.coolColorNames[i]) |
|||
)); |
|||
Widget _buildBottomPicker(Widget picker) { |
|||
return new Container( |
|||
height: CupertinoPickerDemoUtils._kPickerSheetHeight, |
|||
padding: EdgeInsets.only(top: 6.0f), |
|||
color: CupertinoColors.white, |
|||
child: new DefaultTextStyle( |
|||
style: new TextStyle( |
|||
color: CupertinoColors.black, |
|||
fontSize: 22.0f |
|||
), |
|||
child: new GestureDetector( |
|||
// Blocks taps from propagating to the modal sheet and popping.
|
|||
onTap: () => { }, |
|||
child: new SafeArea( |
|||
top: false, |
|||
child: picker |
|||
) |
|||
) |
|||
) |
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
semanticsDismissible: true, |
|||
builder: (BuildContext context1) =>{ |
|||
return new _BottomPicker( |
|||
child: new CupertinoPicker( |
|||
scrollController: scrollController, |
|||
itemExtent: CupertinoPickerDemoUtils._kPickerItemHeight, |
|||
backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1), |
|||
onSelectedItemChanged: (int index)=> { |
|||
setState(() => _selectedColorIndex = index); |
|||
}, |
|||
children: widgets |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
Widget _buildColorPicker(BuildContext context) { |
|||
FixedExtentScrollController scrollController = |
|||
new FixedExtentScrollController(initialItem: this._selectedColorIndex); |
|||
|
|||
List<Widget> generateList() { |
|||
var list = new List<Widget>(); |
|||
foreach (var item in CupertinoNavigationDemoUtils.coolColorNames) { |
|||
list.Add(new Center(child: |
|||
new Text(item) |
|||
)); |
|||
} |
|||
|
|||
return list; |
|||
}, |
|||
child: new _Menu( |
|||
children: new List<Widget>{ |
|||
new Text("Favorite Color"), |
|||
new Text( |
|||
CupertinoPickerDemoUtils.coolColorNames[_selectedColorIndex], |
|||
style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context)) |
|||
) |
|||
|
|||
|
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
builder: (BuildContext _context) => { |
|||
return this._buildBottomPicker( |
|||
new CupertinoPicker( |
|||
scrollController: scrollController, |
|||
itemExtent: CupertinoPickerDemoUtils._kPickerItemHeight, |
|||
backgroundColor: CupertinoColors.white, |
|||
onSelectedItemChanged: (int index) => { |
|||
this.setState(() => this._selectedColorIndex = index); |
|||
}, |
|||
children: generateList() |
|||
) |
|||
); |
|||
} |
|||
); |
|||
}, |
|||
child: this._buildMenu(new List<Widget> { |
|||
new Text("Favorite Color"), |
|||
new Text( |
|||
CupertinoNavigationDemoUtils.coolColorNames[this._selectedColorIndex], |
|||
style: new TextStyle( |
|||
color: CupertinoColors.inactiveGray |
|||
) |
|||
) |
|||
} |
|||
) |
|||
); |
|||
} |
|||
|
|||
Widget _buildCountdownTimerPicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
builder: (BuildContext _context) => { |
|||
return this._buildBottomPicker( |
|||
new CupertinoTimerPicker( |
|||
initialTimerDuration: this.timer, |
|||
onTimerDurationChanged: (TimeSpan newTimer) => { |
|||
this.setState(() => this.timer = newTimer); |
|||
} |
|||
) |
|||
); |
|||
} |
|||
); |
|||
}, |
|||
child: this._buildMenu(new List<Widget> { |
|||
new Text("Countdown Timer"), |
|||
new Text( |
|||
$"{this.timer.Hours}:" + |
|||
$"{(this.timer.Minutes % 60).ToString("00")}:" + |
|||
$"{(this.timer.Seconds % 60).ToString("00")}", |
|||
style: new TextStyle(color: CupertinoColors.inactiveGray) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
Widget _buildCountdownTimerPicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () => |
|||
{ |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
semanticsDismissible: true, |
|||
builder: (BuildContext context1) => |
|||
{ |
|||
return new _BottomPicker( |
|||
child: new CupertinoTimerPicker( |
|||
backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1), |
|||
initialTimerDuration: timer, |
|||
onTimerDurationChanged: (TimeSpan newTimer) =>{ |
|||
setState(() => timer = newTimer); |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
}, |
|||
child: new _Menu( |
|||
children: new List<Widget>{ |
|||
new Text("Countdown Timer"), |
|||
new Text( |
|||
$"{timer.Hours}:" + |
|||
$"{(timer.Minutes % 60).ToString("00")}:" + |
|||
$"{(timer.Seconds % 60).ToString("00")}", |
|||
style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context)) |
|||
), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
Widget _buildDatePicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
builder: (BuildContext _context) => { |
|||
return this._buildBottomPicker( |
|||
new CupertinoDatePicker( |
|||
mode: CupertinoDatePickerMode.date, |
|||
initialDateTime: this.date, |
|||
onDateTimeChanged: (DateTime newDateTime) => { |
|||
this.setState(() => this.date = newDateTime); |
|||
} |
|||
) |
|||
); |
|||
} |
|||
); |
|||
}, |
|||
child: this._buildMenu(new List<Widget> { |
|||
new Text("Date"), |
|||
new Text( |
|||
this.date.ToString("MMMM dd, yyyy"), |
|||
style: new TextStyle(color: CupertinoColors.inactiveGray) |
|||
) |
|||
Widget _buildDatePicker(BuildContext context) |
|||
{ |
|||
return new GestureDetector( |
|||
onTap: () => |
|||
{ |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
semanticsDismissible: true, |
|||
builder: (BuildContext context1) => |
|||
{ |
|||
return new _BottomPicker( |
|||
child: new CupertinoDatePicker( |
|||
backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1), |
|||
mode: CupertinoDatePickerMode.date, |
|||
initialDateTime: date, |
|||
onDateTimeChanged: (DateTime newDateTime) =>{ |
|||
setState(() => date = newDateTime); |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
}, |
|||
child: new _Menu( |
|||
children: new List<Widget>{ |
|||
new Text("Date"), |
|||
new Text( |
|||
date.ToString("MMMM dd, yyyy"), |
|||
style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context)) |
|||
), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
Widget _buildTimePicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
builder: (BuildContext _context) => { |
|||
return this._buildBottomPicker( |
|||
new CupertinoDatePicker( |
|||
mode: CupertinoDatePickerMode.time, |
|||
initialDateTime: this.time, |
|||
onDateTimeChanged: (DateTime newDateTime) => { |
|||
this.setState(() => this.time = newDateTime); |
|||
} |
|||
) |
|||
); |
|||
} |
|||
); |
|||
}, |
|||
child: this._buildMenu(new List<Widget> { |
|||
new Text("Time"), |
|||
new Text( |
|||
this.time.ToString("h:mm tt"), |
|||
style: new TextStyle(color: CupertinoColors.inactiveGray) |
|||
) |
|||
Widget _buildTimePicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () =>{ |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
semanticsDismissible: true, |
|||
builder: (BuildContext context1) =>{ |
|||
return new _BottomPicker( |
|||
child: new CupertinoDatePicker( |
|||
backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1), |
|||
mode: CupertinoDatePickerMode.time, |
|||
initialDateTime: time, |
|||
onDateTimeChanged: (newDateTime) => { |
|||
setState(() => time = newDateTime); |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
}, |
|||
child:new _Menu( |
|||
children: new List<Widget>{ |
|||
new Text("Time"), |
|||
new Text( |
|||
time.ToString("h:mm tt"), |
|||
style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context)) |
|||
), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
Widget _buildDateAndTimePicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
builder: (BuildContext _context) => { |
|||
return this._buildBottomPicker( |
|||
new CupertinoDatePicker( |
|||
mode: CupertinoDatePickerMode.dateAndTime, |
|||
initialDateTime: this.dateTime, |
|||
onDateTimeChanged: (DateTime newDateTime) => { |
|||
this.setState(() => this.dateTime = newDateTime); |
|||
} |
|||
) |
|||
); |
|||
} |
|||
); |
|||
}, |
|||
child: this._buildMenu(new List<Widget> { |
|||
new Text("Date and Time"), |
|||
new Text( |
|||
this.dateTime.ToString("MMMM dd, yyyy h:mm tt"), |
|||
style: new TextStyle(color: CupertinoColors.inactiveGray) |
|||
) |
|||
Widget _buildDateAndTimePicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: ()=> { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
semanticsDismissible: true, |
|||
builder: (BuildContext context1) =>{ |
|||
return new _BottomPicker( |
|||
child: new CupertinoDatePicker( |
|||
backgroundColor: CupertinoColors.systemBackground.resolveFrom(context1), |
|||
mode: CupertinoDatePickerMode.dateAndTime, |
|||
initialDateTime: dateTime, |
|||
onDateTimeChanged: (newDateTime) => { |
|||
setState(() => dateTime = newDateTime); |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
}, |
|||
child: new _Menu( |
|||
children:new List<Widget>{ |
|||
new Text("Date and Time"), |
|||
new Text( |
|||
dateTime.ToString("MMMM dd, yyyy") + " " + dateTime.ToString("HH:mm tt"), |
|||
style: new TextStyle(color: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context)) |
|||
), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
public override Widget build(BuildContext context) { |
|||
return new CupertinoPageScaffold( |
|||
navigationBar: new CupertinoNavigationBar( |
|||
middle: new Text("Picker"), |
|||
// We"re specifying a back label here because the previous page is a
|
|||
// Material page. CupertinoPageRoutes could auto-populate these back
|
|||
// labels.
|
|||
previousPageTitle: "Cupertino", |
|||
trailing: new CupertinoDemoDocumentationButton(CupertinoPickerDemo.routeName) |
|||
), |
|||
child: new DefaultTextStyle( |
|||
style: CupertinoTheme.of(context).textTheme.textStyle, |
|||
child: new DecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: CupertinoTheme.of(context).brightness == Brightness.light |
|||
? CupertinoColors.extraLightBackgroundGray |
|||
: CupertinoColors.darkBackgroundGray |
|||
), |
|||
child: new SafeArea( |
|||
child: new ListView( |
|||
children: new List<Widget> { |
|||
new Padding(padding: EdgeInsets.only(top: 32.0f)), |
|||
this._buildColorPicker(context), |
|||
this._buildCountdownTimerPicker(context), |
|||
this._buildDatePicker(context), |
|||
this._buildTimePicker(context), |
|||
this._buildDateAndTimePicker(context) |
|||
} |
|||
) |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
public override Widget build(BuildContext context) { |
|||
return new CupertinoPageScaffold( |
|||
navigationBar: new CupertinoNavigationBar( |
|||
middle: new Text("Picker"), |
|||
// We're specifying a back label here because the previous page is a
|
|||
// Material page. CupertinoPageRoutes could auto-populate these back
|
|||
// labels.
|
|||
previousPageTitle: "Cupertino" |
|||
//trailing: CupertinoDemoDocumentationButton(CupertinoPickerDemo.routeName)
|
|||
), |
|||
child: new DefaultTextStyle( |
|||
style: CupertinoTheme.of(context).textTheme.textStyle, |
|||
child: new ListView( |
|||
children: new List<Widget>{ |
|||
new Padding(padding: EdgeInsets.only(top: 32.0f)), |
|||
_buildColorPicker(context), |
|||
_buildCountdownTimerPicker(context), |
|||
_buildDatePicker(context), |
|||
_buildTimePicker(context), |
|||
_buildDateAndTimePicker(context), |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class _BottomPicker : StatelessWidget { |
|||
public _BottomPicker( |
|||
Key key = null, |
|||
Widget child = null |
|||
) : base(key: key){ |
|||
D.assert(child != null); |
|||
this.child = child; |
|||
} |
|||
public readonly Widget child; |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new Container( |
|||
height: CupertinoPickerDemoUtils._kPickerSheetHeight, |
|||
padding: EdgeInsets.only(top: 6.0f), |
|||
color: CupertinoColors.label.resolveFrom(context).darkColor, |
|||
child: new DefaultTextStyle( |
|||
style: new TextStyle( |
|||
color: CupertinoColors.label.resolveFrom(context), |
|||
fontSize: 22.0f |
|||
), |
|||
child: new GestureDetector( |
|||
onTap: () =>{ }, |
|||
child: new SafeArea( |
|||
top: false, |
|||
child: child |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
} |
|||
|
|||
public class _Menu : StatelessWidget { |
|||
public _Menu( |
|||
Key key = null, |
|||
List<Widget> children = null |
|||
) :base(key: key) { |
|||
D.assert(children != null); |
|||
this.children = children; |
|||
} |
|||
|
|||
public readonly List<Widget> children; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Container( |
|||
decoration: new BoxDecoration( |
|||
border: new Border( |
|||
top: new BorderSide(color: CupertinoColors.inactiveGray, width: 0), |
|||
bottom: new BorderSide(color: CupertinoColors.inactiveGray, width: 0) |
|||
) |
|||
), |
|||
height: 44, |
|||
child: new Padding( |
|||
padding: EdgeInsets.symmetric(horizontal: 16), |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: children |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: edc3bae86553f44c2b7e7fddbf6cb497 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 27e2b642479d4616ad980ef32f76e152 |
|||
timeCreated: 1612406310 |
|
|||
fileFormatVersion: 2 |
|||
guid: 98bee0a7e51f4f2d9c8670daf147a15f |
|||
timeCreated: 1553145970 |
|||
guid: 0d229d2babb945ec933ff8ce2c53a9f4 |
|||
timeCreated: 1612406341 |
|
|||
fileFormatVersion: 2 |
|||
guid: 7c1d20efeafe42699212e2147c0828af |
|||
timeCreated: 1553149093 |
|||
guid: c1ce2a2020fa4af0b42ffceb1bba8f6a |
|||
timeCreated: 1612409991 |
|
|||
fileFormatVersion: 2 |
|||
guid: d279028b09c04c2b8ab3fba122868004 |
|||
timeCreated: 1553221768 |
|||
guid: 0141eef318dd42e6acc4f3400430dcc8 |
|||
timeCreated: 1612419869 |
|
|||
using System; |
|||
using Unity.UIWidgets.foundation; |
|||
using UIWidgetsGallery.gallery; |
|||
namespace UIWidgetsGallery.gallery { |
|||
class ButtonsDemo : StatefulWidget { |
|||
public const string routeName = "/material/buttons"; |
|||
|
|||
public ButtonsDemo(Key key = null) : base(key: key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _ButtonsDemoState(); |
|||
} |
|||
} |
|||
|
|||
class _ButtonsDemoState : State<ButtonsDemo> { |
|||
const string _raisedText = |
|||
namespace UIWidgetsGallery.demo.material |
|||
{ |
|||
public static class ButtonsDemoUtils |
|||
{ |
|||
public static readonly string _raisedText = |
|||
"functions on busy or wide spaces."; |
|||
"functions on busy or wide spaces."; |
|||
const string _raisedCode = "buttons_raised"; |
|||
public static readonly string _raisedCode = "buttons_raised"; |
|||
const string _flatText = "A flat button displays an ink splash on press " + |
|||
"but does not lift. Use flat buttons on toolbars, in dialogs and " + |
|||
"inline with padding"; |
|||
public static readonly string _flatText = "A flat button displays an ink splash on press " + |
|||
"but does not lift. Use flat buttons on toolbars, in dialogs and " + |
|||
"inline with padding"; |
|||
const string _flatCode = "buttons_flat"; |
|||
public static readonly string _flatCode = "buttons_flat"; |
|||
const string _outlineText = |
|||
public static readonly string _outlineText = |
|||
"paired with raised buttons to indicate an alternative, secondary action."; |
|||
"paired with raised buttons to indicate an alternative, secondary action."; |
|||
const string _outlineCode = "buttons_outline"; |
|||
public static readonly string _outlineCode = "buttons_outline"; |
|||
const string _dropdownText = |
|||
"A dropdown button displays a menu that's used to select a value from a " + |
|||
"small set of values. The button displays the current value and a down " + |
|||
"arrow."; |
|||
public static readonly string _dropdownText = |
|||
"A dropdown button displays a menu that\"s used to select a value from a " + |
|||
"small set of values. The button displays the current value and a down " + |
|||
"arrow."; |
|||
const string _dropdownCode = "buttons_dropdown"; |
|||
public static readonly string _dropdownCode = "buttons_dropdown"; |
|||
const string _iconText = |
|||
public static readonly string _iconText = |
|||
"to be selected or deselected, such as adding or removing an item's star."; |
|||
"to be selected or deselected, such as adding or removing an item\"s star."; |
|||
const string _iconCode = "buttons_icon"; |
|||
public static readonly string _iconCode = "buttons_icon"; |
|||
const string _actionText = |
|||
public static readonly string _actionText = |
|||
"distinguished by a circled icon floating above the UI and can have motion " + |
|||
"behaviors that include morphing, launching, and a transferring anchor " + |
|||
"point."; |
|||
"distinguished by a circled icon floating above the UI and can have motion " + |
|||
"behaviors that include morphing, launching, and a transferring anchor " + |
|||
"point."; |
|||
const string _actionCode = "buttons_action"; |
|||
public static readonly string _actionCode = "buttons_action"; |
|||
} |
|||
|
|||
class ButtonsDemo : StatefulWidget { |
|||
public static readonly string routeName = "/material/buttons"; |
|||
ShapeBorder _buttonShape; |
|||
public override State createState() => new _ButtonsDemoState(); |
|||
} |
|||
|
|||
class _ButtonsDemoState : State<ButtonsDemo> { |
|||
ShapeBorder _buttonShape; |
|||
public _ButtonsDemoState() { |
|||
} |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
ButtonThemeData buttonTheme = ButtonTheme.of(context).copyWith( |
|||
shape: _buttonShape |
|||
); |
|||
public override Widget build(BuildContext context) { |
|||
ButtonThemeData buttonTheme = ButtonTheme.of(context).copyWith( |
|||
shape: this._buttonShape |
|||
); |
|||
List<ComponentDemoTabData> demos = new List<ComponentDemoTabData>{ |
|||
new ComponentDemoTabData( |
|||
tabName: "RAISED", |
|||
description: ButtonsDemoUtils._raisedText, |
|||
demoWidget: ButtonTheme.fromButtonThemeData( |
|||
data: buttonTheme, |
|||
child: buildRaisedButton() |
|||
), |
|||
exampleCodeTag: ButtonsDemoUtils._raisedCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/RaisedButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "FLAT", |
|||
description: ButtonsDemoUtils._flatText, |
|||
demoWidget: ButtonTheme.fromButtonThemeData( |
|||
data: buttonTheme, |
|||
child: buildFlatButton() |
|||
), |
|||
exampleCodeTag: ButtonsDemoUtils._flatCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/FlatButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "OUTLINE", |
|||
description: ButtonsDemoUtils._outlineText, |
|||
demoWidget: ButtonTheme.fromButtonThemeData( |
|||
data: buttonTheme, |
|||
child: buildOutlineButton() |
|||
), |
|||
exampleCodeTag: ButtonsDemoUtils._outlineCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/OutlineButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "DROPDOWN", |
|||
description: ButtonsDemoUtils._dropdownText, |
|||
demoWidget: buildDropdownButton(), |
|||
exampleCodeTag: ButtonsDemoUtils._dropdownCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/DropdownButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "ICON", |
|||
description: ButtonsDemoUtils._iconText, |
|||
demoWidget: buildIconButton(), |
|||
exampleCodeTag: ButtonsDemoUtils._iconCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/IconButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "ACTION", |
|||
description: ButtonsDemoUtils._actionText, |
|||
demoWidget: buildActionButton(), |
|||
exampleCodeTag: ButtonsDemoUtils._actionCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/FloatingActionButton-class.html" |
|||
) |
|||
}; |
|||
List<ComponentDemoTabData> demos = new List<ComponentDemoTabData> { |
|||
new ComponentDemoTabData( |
|||
tabName: "RAISED", |
|||
description: _raisedText, |
|||
demoWidget: ButtonTheme.fromButtonThemeData( |
|||
data: buttonTheme, |
|||
child: this.buildRaisedButton() |
|||
), |
|||
exampleCodeTag: _raisedCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/RaisedButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "FLAT", |
|||
description: _flatText, |
|||
demoWidget: ButtonTheme.fromButtonThemeData( |
|||
data: buttonTheme, |
|||
child: this.buildFlatButton() |
|||
), |
|||
exampleCodeTag: _flatCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/FlatButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "OUTLINE", |
|||
description: _outlineText, |
|||
demoWidget: ButtonTheme.fromButtonThemeData( |
|||
data: buttonTheme, |
|||
child: this.buildOutlineButton() |
|||
), |
|||
exampleCodeTag: _outlineCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/OutlineButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "DROPDOWN", |
|||
description: _dropdownText, |
|||
demoWidget: this.buildDropdownButton(), |
|||
exampleCodeTag: _dropdownCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/DropdownButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "ICON", |
|||
description: _iconText, |
|||
demoWidget: this.buildIconButton(), |
|||
exampleCodeTag: _iconCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/IconButton-class.html" |
|||
), |
|||
new ComponentDemoTabData( |
|||
tabName: "ACTION", |
|||
description: _actionText, |
|||
demoWidget: this.buildActionButton(), |
|||
exampleCodeTag: _actionCode, |
|||
documentationUrl: "https://docs.flutter.io/flutter/material/FloatingActionButton-class.html" |
|||
) |
|||
}; |
|||
return new TabbedComponentDemoScaffold( |
|||
title: "Buttons", |
|||
demos: demos, |
|||
actions: new List<Widget>{ |
|||
new IconButton( |
|||
icon: new Icon(Icons.sentiment_very_satisfied), |
|||
onPressed: () => { |
|||
setState(() => { |
|||
_buttonShape = _buttonShape == null ? new StadiumBorder() : null; |
|||
}); |
|||
} |
|||
) |
|||
} |
|||
); |
|||
} |
|||
return new TabbedComponentDemoScaffold( |
|||
title: "Buttons", |
|||
demos: demos, |
|||
actions: new List<Widget> { |
|||
new IconButton( |
|||
icon: new Icon(Icons.sentiment_very_satisfied), |
|||
onPressed: () => { |
|||
this.setState(() => { |
|||
this._buttonShape = this._buttonShape == null ? new StadiumBorder() : null; |
|||
}); |
|||
} |
|||
) |
|||
Widget buildRaisedButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new RaisedButton( |
|||
child: new Text("RAISED BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
); |
|||
} |
|||
|
|||
public Widget buildRaisedButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new RaisedButton( |
|||
child: new Text("RAISED BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
new RaisedButton( |
|||
child: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
), |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
RaisedButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("RAISED BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
RaisedButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
) |
|||
} |
|||
) |
|||
); |
|||
), |
|||
new RaisedButton( |
|||
child: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
), |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
RaisedButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("RAISED BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
RaisedButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
public Widget buildFlatButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new FlatButton( |
|||
child: new Text("FLAT BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
new FlatButton( |
|||
child: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
), |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
FlatButton.icon( |
|||
icon: new Icon(Icons.add_circle_outline, size: 18.0f), |
|||
label: new Text("FLAT BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
FlatButton.icon( |
|||
icon: new Icon(Icons.add_circle_outline, size: 18.0f), |
|||
label: new Text("DISABLED"), |
|||
onPressed: null |
|||
), |
|||
} |
|||
) |
|||
} |
|||
) |
|||
); |
|||
Widget buildFlatButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new FlatButton( |
|||
child: new Text("FLAT BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
new FlatButton( |
|||
child: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
), |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
FlatButton.icon( |
|||
icon: new Icon(Icons.add_circle_outline, size: 18.0f), |
|||
label: new Text("FLAT BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
FlatButton.icon( |
|||
icon: new Icon(Icons.add_circle_outline, size: 18.0f), |
|||
label: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
Widget buildOutlineButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new OutlineButton( |
|||
child: new Text("OUTLINE BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
|
|||
new OutlineButton( |
|||
child: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
), |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
OutlineButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("OUTLINE BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
OutlineButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
) |
|||
} |
|||
) |
|||
); |
|||
Widget buildOutlineButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new OutlineButton( |
|||
child: new Text("OUTLINE BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
new OutlineButton( |
|||
child: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
), |
|||
new ButtonBar( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
OutlineButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("OUTLINE BUTTON"), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
} |
|||
), |
|||
OutlineButton.icon( |
|||
icon: new Icon(Icons.add, size: 18.0f), |
|||
label: new Text("DISABLED"), |
|||
onPressed: null |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
// https://en.wikipedia.org/wiki/Free_Four
|
|||
string dropdown1Value = "Free"; |
|||
string dropdown2Value; |
|||
string dropdown3Value = "Four"; |
|||
// https://en.wikipedia.org/wiki/Free_Four
|
|||
string dropdown1Value = "Free"; |
|||
string dropdown2Value = null; |
|||
string dropdown3Value = "Four"; |
|||
public Widget buildDropdownButton() { |
|||
return new Padding( |
|||
padding: EdgeInsets.all(24.0f), |
|||
child: new Column( |
|||
mainAxisAlignment: MainAxisAlignment.start, |
|||
children: new List<Widget> { |
|||
new ListTile( |
|||
title: new Text("Simple dropdown:"), |
|||
trailing: new DropdownButton<string>( |
|||
value: this.dropdown1Value, |
|||
onChanged: (string newValue) => { |
|||
this.setState(() => { this.dropdown1Value = newValue; }); |
|||
}, |
|||
items: new List<string> {"One", "Two", "Free", "Four"}.Select((string value) => { |
|||
return new DropdownMenuItem<string>( |
|||
value: value, |
|||
child: new Text(value) |
|||
); |
|||
}).ToList() |
|||
) |
|||
), |
|||
new SizedBox( |
|||
height: 24.0f |
|||
), |
|||
new ListTile( |
|||
title: new Text("Dropdown with a hint:"), |
|||
trailing: new DropdownButton<string>( |
|||
value: this.dropdown2Value, |
|||
hint: new Text("Choose"), |
|||
onChanged: (string newValue) => { |
|||
this.setState(() => { this.dropdown2Value = newValue; }); |
|||
}, |
|||
items: new List<string> {"One", "Two", "Free", "Four"}.Select((string value) => { |
|||
return new DropdownMenuItem<string>( |
|||
value: value, |
|||
child: new Text(value) |
|||
); |
|||
}).ToList() |
|||
) |
|||
), |
|||
new SizedBox( |
|||
height: 24.0f |
|||
), |
|||
new ListTile( |
|||
title: new Text("Scrollable dropdown:"), |
|||
trailing: new DropdownButton<string>( |
|||
value: this.dropdown3Value, |
|||
onChanged: (string newValue) => { |
|||
this.setState(() => { this.dropdown3Value = newValue; }); |
|||
}, |
|||
items: new List<string> { |
|||
"One", "Two", "Free", "Four", "Can", "I", "Have", "A", "Little", |
|||
"Bit", "More", "Five", "Six", "Seven", "Eight", "Nine", "Ten" |
|||
}.Select<string, DropdownMenuItem<string>>(value => { |
|||
return new DropdownMenuItem<string>( |
|||
value: value, |
|||
child: new Text(value) |
|||
); |
|||
}).ToList() |
|||
) |
|||
) |
|||
} |
|||
) |
|||
); |
|||
Widget buildDropdownButton() { |
|||
return new Padding( |
|||
padding: EdgeInsets.all(24.0f), |
|||
child: new Column( |
|||
mainAxisAlignment: MainAxisAlignment.start, |
|||
children: new List<Widget>{ |
|||
new ListTile( |
|||
title: new Text("Simple dropdown:"), |
|||
trailing: new DropdownButton<string>( |
|||
value: dropdown1Value, |
|||
onChanged: (string newValue) => { |
|||
setState(() => { |
|||
dropdown1Value = newValue; |
|||
}); |
|||
}, |
|||
items: new List<string>{"One", "Two", "Free", "Four"}.Select<string, DropdownMenuItem<string>>((string value) => { |
|||
return new DropdownMenuItem<string>( |
|||
value: value, |
|||
child: new Text(value) |
|||
); |
|||
}).ToList() |
|||
) |
|||
), |
|||
new SizedBox( |
|||
height: 24.0f |
|||
), |
|||
new ListTile( |
|||
title: new Text("Dropdown with a hint:"), |
|||
trailing: new DropdownButton<string>( |
|||
value: dropdown2Value, |
|||
hint: new Text("Choose"), |
|||
onChanged: (string newValue) => { |
|||
setState(() => { |
|||
dropdown2Value = newValue; |
|||
}); |
|||
}, |
|||
items: new List<string>{"One", "Two", "Free", "Four"}.Select<string, DropdownMenuItem<string>>((string value) => { |
|||
return new DropdownMenuItem<string>( |
|||
value: value, |
|||
child: new Text(value) |
|||
); |
|||
}).ToList() |
|||
) |
|||
), |
|||
new SizedBox( |
|||
height: 24.0f |
|||
), |
|||
new ListTile( |
|||
title: new Text("Scrollable dropdown:"), |
|||
trailing: new DropdownButton<string>( |
|||
value: dropdown3Value, |
|||
onChanged: (string newValue) => { |
|||
setState(() => { |
|||
dropdown3Value = newValue; |
|||
}); |
|||
}, |
|||
items: new List<string>{ |
|||
"One", "Two", "Free", "Four", "Can", "I", "Have", "A", "Little", |
|||
"Bit", "More", "Five", "Six", "Seven", "Eight", "Nine", "Ten", |
|||
} |
|||
.Select<string, DropdownMenuItem<string>>((string value) => { |
|||
return new DropdownMenuItem<string>( |
|||
value: value, |
|||
child: new Text(value) |
|||
); |
|||
}) |
|||
.ToList() |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
bool iconButtonToggle = false; |
|||
bool iconButtonToggle = false; |
|||
public Widget buildIconButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Row( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new IconButton( |
|||
icon: new Icon( |
|||
Icons.thumb_up |
|||
), |
|||
onPressed: () => { this.setState(() => this.iconButtonToggle = !this.iconButtonToggle); }, |
|||
color: this.iconButtonToggle ? Theme.of(this.context).primaryColor : null |
|||
), |
|||
new IconButton( |
|||
icon: new Icon( |
|||
Icons.thumb_up |
|||
), |
|||
onPressed: null |
|||
) |
|||
}.Select<Widget, Widget>( |
|||
(Widget button) => new SizedBox(width: 64.0f, height: 64.0f, child: button)).ToList() |
|||
) |
|||
); |
|||
Widget buildIconButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new Row( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget>{ |
|||
new IconButton( |
|||
icon: new Icon( |
|||
Icons.thumb_up |
|||
), |
|||
onPressed: () =>{ |
|||
setState(() => iconButtonToggle = !iconButtonToggle); |
|||
}, |
|||
color: iconButtonToggle ? Theme.of(context).primaryColor : null |
|||
), |
|||
new IconButton( |
|||
icon: new Icon( |
|||
Icons.thumb_up |
|||
), |
|||
onPressed: null |
|||
) |
|||
.Select<Widget, Widget>((Widget button) => new SizedBox(width: 64.0f, height: 64.0f, child: button)) |
|||
.ToList() |
|||
) |
|||
); |
|||
} |
|||
public Widget buildActionButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new FloatingActionButton( |
|||
child: new Icon(Icons.add), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
}, |
|||
tooltip: "floating action button" |
|||
) |
|||
); |
|||
} |
|||
} |
|||
Widget buildActionButton() { |
|||
return new Align( |
|||
alignment: new Alignment(0.0f, -0.2f), |
|||
child: new FloatingActionButton( |
|||
child: new Icon(Icons.add), |
|||
onPressed: () => { |
|||
// Perform some action
|
|||
}, |
|||
tooltip: "floating action button" |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bf7a009b9ad594f1887c1178cd01160b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: d6d69568df64484b9aaee159d11dffc8 |
|||
timeCreated: 1612421132 |
|
|||
fileFormatVersion: 2 |
|||
guid: f199ea32d87544c892f57b8af0fcbb03 |
|||
timeCreated: 1553136548 |
|||
guid: e5eef436049c4b8ba60592f26681bb56 |
|||
timeCreated: 1612423408 |
|
|||
fileFormatVersion: 2 |
|||
guid: c65920c8c4b64c709b62586d0bde9579 |
|||
timeCreated: 1555411023 |
|||
guid: f9c596e7b509434aab8b7b7830e287ab |
|||
timeCreated: 1612425059 |
|
|||
fileFormatVersion: 2 |
|||
guid: d8fcf06db4da2449885ccc1f225b4808 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: acc0d8629d884dbd9670b0cb3bb3e6ec |
|||
timeCreated: 1612430045 |
|
|||
fileFormatVersion: 2 |
|||
guid: afb410d95c524a18b8761713f1335427 |
|||
timeCreated: 1555059936 |
|||
guid: c949d1ae2a444ef085b83e1a0db18cc9 |
|||
timeCreated: 1612683278 |
|
|||
fileFormatVersion: 2 |
|||
guid: d218ac05e5b514d148358d3cd23ff43f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 958332d4fa614f18b3d446a66cc0f93d |
|||
timeCreated: 1612682743 |
|
|||
fileFormatVersion: 2 |
|||
guid: 2621a6f94ad8a4b5ab7199025967dc90 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: fb97b78a8c204fbb9c9dbf667cb23004 |
|||
timeCreated: 1612342718 |
|
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.ui; |
|||
using System; |
|||
using UIWidgetsGallery.demo.shrine; |
|||
using Unity.UIWidgets.foundation; |
|||
namespace UIWidgetsGallery.gallery { |
|||
class ShrineDemoUtils { |
|||
public static Widget buildShrine(BuildContext context, Widget child) { |
|||
return new Theme( |
|||
data: new ThemeData( |
|||
primarySwatch: Colors.grey, |
|||
iconTheme: new IconThemeData(color: new Color(0xFF707070)), |
|||
platform: Theme.of(context).platform |
|||
), |
|||
child: new ShrineTheme(child: child) |
|||
); |
|||
} |
|||
} |
|||
namespace UIWidgetsGallery.demo |
|||
{ |
|||
class ShrineDemo : StatelessWidget |
|||
{ |
|||
public ShrineDemo(Key key = null) : base(key: key){} |
|||
public class ShrinePageRoute<T> : MaterialPageRoute { |
|||
public ShrinePageRoute( |
|||
WidgetBuilder builder, |
|||
RouteSettings settings |
|||
) : base(builder: builder, settings: settings) { |
|||
} |
|||
|
|||
public override Widget buildPage(BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation) { |
|||
return ShrineDemoUtils.buildShrine(context, base.buildPage(context, animation, secondaryAnimation)); |
|||
} |
|||
} |
|||
public static readonly string routeName = "/shrine"; |
|||
public class ShrineDemo : StatelessWidget { |
|||
public const string routeName = "/shrine"; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return ShrineDemoUtils.buildShrine(context, new ShrineHome()); |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new ShrineApp(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5902905cca7447d2aa1fe5ae7f6c5cbc |
|||
timeCreated: 1553239620 |
|||
guid: b5da65292c17429ba697ebdefb05c8e4 |
|||
timeCreated: 1612512022 |
|
|||
fileFormatVersion: 2 |
|||
guid: 05f67c3cc663543059f6e339e99ce4b8 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 20b07a92c4c64919aa3adf9322758a65 |
|||
timeCreated: 1612322595 |
|
|||
fileFormatVersion: 2 |
|||
guid: 3fff3cf3a1dd243d088be72945a3d7e9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 63b65dbf55ef42bb81d7836bd42d60c9 |
|||
timeCreated: 1612341675 |
|
|||
fileFormatVersion: 2 |
|||
guid: f3ee24c4986845abb1356402632d8524 |
|||
timeCreated: 1552886622 |
|||
guid: a1683ac7e52d43c2b016d6f38ee988ad |
|||
timeCreated: 1612334782 |
|
|||
fileFormatVersion: 2 |
|||
guid: 3c8404e1b03d43aba2e91d19f124de5e |
|||
timeCreated: 1552462303 |
|||
guid: a66930d03e874eb0ba49812d9c1f952f |
|||
timeCreated: 1612409591 |
|
|||
fileFormatVersion: 2 |
|||
guid: b079397083e3d41bb83262e1423dfa25 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: beaf8ef32d5a4e4b847b0626276b30ca |
|||
timeCreated: 1612337523 |
|
|||
fileFormatVersion: 2 |
|||
guid: b6b1570fca0b749e688be67e7bb61a5c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 5c8e2b6d71b743648d57a549e2b0c62e |
|||
timeCreated: 1612338820 |
|
|||
fileFormatVersion: 2 |
|||
guid: 7b7592e2675d347bb9036ed6cb4fabe0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 77d0b3e255db46828d85f61b587bcb43 |
|||
timeCreated: 1612324774 |
|
|||
fileFormatVersion: 2 |
|||
guid: 9eb439aba25814f79979120cd5966537 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 73fb5821ecc441269db224976d575666 |
|||
timeCreated: 1612324913 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.material; |
|||
namespace UIWidgetsGallery.gallery { |
|||
public class GalleryTextScaleValue : IEquatable<GalleryTextScaleValue> { |
|||
public GalleryTextScaleValue(float? scale = null, string label = null) { |
|||
namespace UIWidgetsGallery.gallery |
|||
{ |
|||
public class GalleryTextScaleValue : IEquatable<GalleryTextScaleValue> |
|||
{ |
|||
public GalleryTextScaleValue(float? scale, string label) |
|||
{ |
|||
|
|||
|
|||
public bool Equals(GalleryTextScaleValue other) { |
|||
if (ReferenceEquals(null, other)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(this, other)) { |
|||
|
|||
public bool Equals(GalleryTextScaleValue other) |
|||
{ |
|||
if (ReferenceEquals(this, other)) |
|||
{ |
|||
return this.scale.Equals(other.scale) && string.Equals(this.label, other.label); |
|||
} |
|||
public override bool Equals(object obj) { |
|||
if (ReferenceEquals(null, obj)) { |
|||
if (ReferenceEquals(other, null)) |
|||
{ |
|||
if (ReferenceEquals(this, obj)) { |
|||
|
|||
return this.scale.Equals(other.scale) && this.label == other.label; |
|||
} |
|||
|
|||
public override bool Equals(object obj) |
|||
{ |
|||
if (ReferenceEquals(this, obj)) |
|||
{ |
|||
if (obj.GetType() != this.GetType()) { |
|||
|
|||
if (ReferenceEquals(obj, null)) |
|||
{ |
|||
return this.Equals((GalleryTextScaleValue) obj); |
|||
|
|||
if (obj.GetType() != GetType()) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return Equals((GalleryTextScaleValue)obj); |
|||
} |
|||
|
|||
public static bool operator==(GalleryTextScaleValue left, GalleryTextScaleValue right) |
|||
{ |
|||
return Equals(left, right); |
|||
public static bool operator !=(GalleryTextScaleValue left, GalleryTextScaleValue right) |
|||
{ |
|||
return !Equals(left, right); |
|||
} |
|||
|
|||
return (this.scale.GetHashCode() * 397) ^ (this.label != null ? this.label.GetHashCode() : 0); |
|||
return ((label?.GetHashCode() ?? 0) * 397) ^ (scale?.GetHashCode() ?? 0); |
|||
public static bool operator ==(GalleryTextScaleValue left, GalleryTextScaleValue right) { |
|||
public override string ToString() |
|||
{ |
|||
return $"{GetType()}{label}"; |
|||
} |
|||
|
|||
public static readonly List<GalleryTextScaleValue> kAllGalleryTextScaleValues = new List<GalleryTextScaleValue>{ |
|||
new GalleryTextScaleValue(null, "System Default"), |
|||
new GalleryTextScaleValue(0.8f, "Small"), |
|||
new GalleryTextScaleValue(1.0f, "Normal"), |
|||
new GalleryTextScaleValue(1.3f, "Large"), |
|||
new GalleryTextScaleValue(2.0f, "Huge"), |
|||
}; |
|||
} |
|||
|
|||
public class GalleryVisualDensityValue : IEquatable<GalleryVisualDensityValue> |
|||
{ |
|||
public GalleryVisualDensityValue(VisualDensity visualDensity, string label) |
|||
{ |
|||
this.visualDensity = visualDensity; |
|||
this.label = label; |
|||
} |
|||
|
|||
public readonly VisualDensity visualDensity; |
|||
public readonly string label; |
|||
|
|||
public bool Equals(GalleryVisualDensityValue other) |
|||
{ |
|||
if (ReferenceEquals(this, other)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (ReferenceEquals(other, null)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return this.visualDensity.Equals(other.visualDensity) && this.label == other.label; |
|||
} |
|||
|
|||
public override bool Equals(object obj) |
|||
{ |
|||
if (ReferenceEquals(this, obj)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (ReferenceEquals(obj, null)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (obj.GetType() != GetType()) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return Equals((GalleryVisualDensityValue)obj); |
|||
} |
|||
|
|||
public static bool operator==(GalleryVisualDensityValue left, GalleryVisualDensityValue right) |
|||
{ |
|||
public static bool operator !=(GalleryTextScaleValue left, GalleryTextScaleValue right) { |
|||
public static bool operator !=(GalleryVisualDensityValue left, GalleryVisualDensityValue right) |
|||
{ |
|||
|
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
return ((label?.GetHashCode() ?? 0) * 397) ^ (visualDensity?.GetHashCode() ?? 0); |
|||
} |
|||
} |
|||
public override string ToString() { |
|||
return $"{this.GetType()}({this.label})"; |
|||
public override string ToString() |
|||
{ |
|||
return $"{GetType()}{label}"; |
|||
public static readonly List<GalleryTextScaleValue> kAllGalleryTextScaleValues = new List<GalleryTextScaleValue> { |
|||
new GalleryTextScaleValue(null, "System Default"), |
|||
new GalleryTextScaleValue(0.8f, "Small"), |
|||
new GalleryTextScaleValue(1.0f, "Normal"), |
|||
new GalleryTextScaleValue(1.3f, "Large"), |
|||
new GalleryTextScaleValue(2.0f, "Huge"), |
|||
public static readonly List<GalleryVisualDensityValue> kAllGalleryVisualDensityValues = new List<GalleryVisualDensityValue>{ |
|||
new GalleryVisualDensityValue(new VisualDensity(), "System Default"), |
|||
new GalleryVisualDensityValue(VisualDensity.comfortable, "Comfortable"), |
|||
new GalleryVisualDensityValue(VisualDensity.compact, "Compact"), |
|||
new GalleryVisualDensityValue(new VisualDensity(horizontal: -3, vertical: -3), "Very Compact") |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9bf87177b342d4feba4778ca5a9b20a5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 536d205536f347459208349c7fb5220c |
|||
timeCreated: 1612324936 |
|
|||
fileFormatVersion: 2 |
|||
guid: 7510605485ec34459a4ac9b456cf583f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 3941efd4d8554df2a6f53ad10cc6ca56 |
|||
timeCreated: 1612324365 |
|
|||
fileFormatVersion: 2 |
|||
guid: c69f6e2d93b02484fab6f2e2408c7d88 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 16139f3d73b447de87560f29d24aff3e |
|||
timeCreated: 1612323458 |
|
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.foundation; |
|||
using UnityEngine; |
|||
|
|||
var pixelRatioProperty = this.serializedObject.FindProperty("devicePixelRatioOverride"); |
|||
var antiAliasingProperty = this.serializedObject.FindProperty("hardwareAntiAliasing"); |
|||
EditorGUILayout.PropertyField(pixelRatioProperty); |
|||
EditorGUILayout.PropertyField(antiAliasingProperty); |
|||
this.serializedObject.ApplyModifiedProperties(); |
|||
EditorGUILayout.PropertyField(serializedObject.FindProperty("fonts"), true); |
|||
EditorGUI.BeginChangeCheck(); |
|||
UIWidgetsPanel panel = (UIWidgetsPanel)target; |
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
|
|||
[MenuItem("UIWidgets/EnableDebug")] |
|||
public static void ToggleDebugMode(){ |
|||
D.enableDebug = !D.enableDebug; |
|||
} |
|||
|
|||
[MenuItem("UIWidgets/EnableDebug",true)] |
|||
public static bool CurrentDebugModeState() { |
|||
Menu.SetChecked("UIWidgets/EnableDebug", D.enableDebug ); |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using System.Runtime.InteropServices; |
|||
using AOT; |
|||
using Unity.UIWidgets.ui; |
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
|
|||
#endif
|
|||
public abstract void cancel(); |
|||
|
|||
public void Dispose() { |
|||
this.cancel(); |
|||
} |
|||
|
|||
public static float timeSinceStartup { |
|||
get { |
|||
#if UNITY_EDITOR
|
|||
return (float) EditorApplication.timeSinceStartup; |
|||
#else
|
|||
return Time.realtimeSinceStartup; |
|||
#endif
|
|||
public static Timer create(TimeSpan duration, ZoneCallback callback) { |
|||
if (Zone.current == Zone.root) { |
|||
return Zone.current.createTimer(duration, callback); |
|||
} |
|||
public static TimeSpan timespanSinceStartup { |
|||
get { return TimeSpan.FromSeconds(timeSinceStartup); } |
|||
return Zone.current |
|||
.createTimer(duration, Zone.current.bindCallbackGuarded(callback)); |
|||
static readonly object _syncObj = new object(); |
|||
|
|||
static LinkedList<Action> _callbacks = new LinkedList<Action>(); |
|||
|
|||
public static void runInMainFromFinalizer(Action callback) { |
|||
lock (_syncObj) { |
|||
_callbacks.AddLast(callback); |
|||
} |
|||
public static Timer create(TimeSpan duration, Action callback) { |
|||
return create(duration, () => { |
|||
callback.Invoke(); |
|||
return null; |
|||
}); |
|||
internal static void update() { |
|||
LinkedList<Action> callbacks; |
|||
|
|||
lock (_syncObj) { |
|||
if (_callbacks.isEmpty()) { |
|||
return; |
|||
} |
|||
|
|||
callbacks = _callbacks; |
|||
_callbacks = new LinkedList<Action>(); |
|||
public static Timer periodic(TimeSpan duration, ZoneUnaryCallback callback) { |
|||
if (Zone.current == Zone.root) { |
|||
return Zone.current.createPeriodicTimer(duration, callback); |
|||
foreach (var callback in callbacks) { |
|||
try { |
|||
callback(); |
|||
} |
|||
catch (Exception ex) { |
|||
D.logError("Error to execute runInMain callback: ", ex); |
|||
} |
|||
} |
|||
var boundCallback = Zone.current.bindUnaryCallbackGuarded(callback); |
|||
return Zone.current.createPeriodicTimer(duration, boundCallback); |
|||
} |
|||
public class TimerProvider { |
|||
readonly PriorityQueue<TimerImpl> _queue; |
|||
|
|||
public TimerProvider() { |
|||
this._queue = new PriorityQueue<TimerImpl>(); |
|||
public static void run(ZoneCallback callback) { |
|||
create(TimeSpan.Zero, callback); |
|||
public Timer runInMain(Action callback) { |
|||
var timer = new TimerImpl(callback); |
|||
public abstract void cancel(); |
|||
lock (this._queue) { |
|||
this._queue.enqueue(timer); |
|||
} |
|||
|
|||
return timer; |
|||
public void Dispose() { |
|||
cancel(); |
|||
public Timer run(TimeSpan duration, Action callback) { |
|||
var timer = new TimerImpl(duration, callback); |
|||
public abstract long tick { get; } |
|||
lock (this._queue) { |
|||
this._queue.enqueue(timer); |
|||
} |
|||
public abstract bool isActive { get; } |
|||
return timer; |
|||
internal static Timer _createTimer(TimeSpan duration, ZoneCallback callback) { |
|||
return _Timer._createTimer(_ => callback(), (int) duration.TotalMilliseconds, false); |
|||
public Timer periodic(TimeSpan duration, Action callback) { |
|||
var timer = new TimerImpl(duration, callback, periodic: true); |
|||
internal static Timer _createPeriodicTimer( |
|||
TimeSpan duration, ZoneUnaryCallback callback) { |
|||
return _Timer._createTimer(callback, (int) duration.TotalMilliseconds, true); |
|||
} |
|||
} |
|||
lock (this._queue) { |
|||
this._queue.enqueue(timer); |
|||
} |
|||
class _Timer : Timer { |
|||
long _tick = 0; |
|||
|
|||
ZoneUnaryCallback _callback; |
|||
long _wakeupTime; |
|||
readonly int _milliSeconds; |
|||
readonly bool _repeating; |
|||
return timer; |
|||
_Timer(ZoneUnaryCallback callback, long wakeupTime, int milliSeconds, bool repeating) { |
|||
_callback = callback; |
|||
_wakeupTime = wakeupTime; |
|||
_milliSeconds = milliSeconds; |
|||
_repeating = repeating; |
|||
|
|||
static readonly List<TimerImpl> _timers = new List<TimerImpl>(); |
|||
static readonly List<TimerImpl> _appendList = new List<TimerImpl>(); |
|||
public void update(Action flushMicroTasks = null) { |
|||
var now = Timer.timeSinceStartup; |
|||
|
|||
_timers.Clear(); |
|||
_appendList.Clear(); |
|||
lock (this._queue) { |
|||
while (this._queue.count > 0 && this._queue.peek().deadline <= now) { |
|||
var timer = this._queue.dequeue(); |
|||
_timers.Add(timer); |
|||
} |
|||
public static TimeSpan timespanSinceStartup { |
|||
get { return TimeSpan.FromMilliseconds(UIMonoState_timerMillisecondClock()); } |
|||
} |
|||
|
|||
internal static _Timer _createTimer(ZoneUnaryCallback callback, int milliSeconds, bool repeating) { |
|||
if (milliSeconds < 0) { |
|||
milliSeconds = 0; |
|||
if (_timers.Count != 0) { |
|||
foreach (var timer in _timers) { |
|||
if (flushMicroTasks != null) { |
|||
flushMicroTasks(); |
|||
} |
|||
long now = UIMonoState_timerMillisecondClock(); |
|||
long wakeupTime = (milliSeconds == 0) ? now : (now + 1 + milliSeconds); |
|||
timer.invoke(); |
|||
if (timer.periodic && !timer.done) { |
|||
_appendList.Add(timer); |
|||
} |
|||
} |
|||
} |
|||
_Timer timer = new _Timer(callback, wakeupTime, milliSeconds, repeating); |
|||
timer._enqueue(); |
|||
if (_appendList.Count != 0) { |
|||
lock (this._queue) { |
|||
foreach (var timer in _appendList) { |
|||
this._queue.enqueue(timer); |
|||
} |
|||
} |
|||
} |
|||
return timer; |
|||
class TimerImpl : Timer, IComparable<TimerImpl> { |
|||
float _deadline; |
|||
readonly Action _callback; |
|||
bool _done; |
|||
|
|||
public readonly bool periodic; |
|||
readonly TimeSpan _interval; |
|||
public override void cancel() { |
|||
_callback = null; |
|||
} |
|||
public TimerImpl(TimeSpan duration, Action callback, bool periodic = false) { |
|||
this._deadline = timeSinceStartup + (float) duration.TotalSeconds; |
|||
this._callback = callback; |
|||
this._done = false; |
|||
public override bool isActive => _callback != null; |
|||
this.periodic = periodic; |
|||
if (periodic) { |
|||
this._interval = duration; |
|||
} |
|||
} |
|||
public override long tick => _tick; |
|||
public TimerImpl(Action callback) { |
|||
this._deadline = 0; |
|||
this._callback = callback; |
|||
this._done = false; |
|||
void _advanceWakeupTime() { |
|||
if (_milliSeconds > 0) { |
|||
_wakeupTime += _milliSeconds; |
|||
|
|||
public float deadline { |
|||
get { return this._deadline; } |
|||
else { |
|||
_wakeupTime = UIMonoState_timerMillisecondClock(); |
|||
} |
|||
public override void cancel() { |
|||
this._done = true; |
|||
} |
|||
const long MILLI_TO_NANO = 1000000L; |
|||
|
|||
void _enqueue() { |
|||
Isolate.ensureExists(); |
|||
|
|||
GCHandle callbackHandle = GCHandle.Alloc(this); |
|||
UIMonoState_postTaskForTime(_postTaskForTime, (IntPtr) callbackHandle, _wakeupTime * MILLI_TO_NANO); |
|||
} |
|||
public bool done { |
|||
get { return this._done; } |
|||
} |
|||
[MonoPInvokeCallback(typeof(UIMonoState_postTaskForTimeCallback))] |
|||
static void _postTaskForTime(IntPtr callbackHandle) { |
|||
GCHandle timerHandle = (GCHandle) callbackHandle; |
|||
var timer = (_Timer) timerHandle.Target; |
|||
timerHandle.Free(); |
|||
public void invoke() { |
|||
if (this._done) { |
|||
return; |
|||
} |
|||
try { |
|||
if (timer._callback != null) { |
|||
var callback = timer._callback; |
|||
if (!timer._repeating) { |
|||
timer._callback = null; |
|||
} |
|||
else if (timer._milliSeconds > 0) { |
|||
var ms = timer._milliSeconds; |
|||
long overdue = UIMonoState_timerMillisecondClock() - timer._wakeupTime; |
|||
if (overdue > ms) { |
|||
long missedTicks = overdue / ms; |
|||
timer._wakeupTime += missedTicks * ms; |
|||
timer._tick += missedTicks; |
|||
} |
|||
} |
|||
var now = timeSinceStartup; |
|||
if (!this.periodic) { |
|||
this._done = true; |
|||
} |
|||
timer._tick += 1; |
|||
try { |
|||
this._callback(); |
|||
} |
|||
catch (Exception ex) { |
|||
D.logError("Error to execute timer callback: ", ex); |
|||
} |
|||
callback(timer); |
|||
if (this.periodic) { |
|||
this._deadline = now + (float) this._interval.TotalSeconds; |
|||
if (timer._repeating && (timer._callback != null)) { |
|||
timer._advanceWakeupTime(); |
|||
timer._enqueue(); |
|||
} |
|||
|
|||
public int CompareTo(TimerImpl other) { |
|||
return this.deadline.CompareTo(other.deadline); |
|||
catch (Exception ex) { |
|||
Debug.LogException(ex); |
|||
|
|||
[DllImport(NativeBindings.dllName)] |
|||
static extern long UIMonoState_timerMillisecondClock(); |
|||
|
|||
delegate void UIMonoState_postTaskForTimeCallback(IntPtr callbackHandle); |
|||
|
|||
[DllImport(NativeBindings.dllName)] |
|||
static extern void UIMonoState_postTaskForTime(UIMonoState_postTaskForTimeCallback callback, |
|||
IntPtr callbackHandle, long targetTimeNanos); |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.widgets; |
|||
using Unity.UIWidgets.painting; |
|||
public static readonly Color activeBlue = new Color(0xFF007AFF); |
|||
public static readonly CupertinoDynamicColor activeBlue = systemBlue; |
|||
public static readonly CupertinoDynamicColor activeGreen = systemGreen; |
|||
public static readonly CupertinoDynamicColor activeOrange = systemOrange; |
|||
|
|||
public static Color white = new Color(0xFFFFFFFF); |
|||
public static Color black = new Color(0xFF000000); |
|||
public static Color lightBackgroundGray = new Color(0xFFE5E5EA); |
|||
public static Color extraLightBackgroundGray = new Color(0xFFEFEFF4); |
|||
public static Color darkBackgroundGray = new Color(0xFF171717); |
|||
|
|||
public static readonly CupertinoDynamicColor inactiveGray = CupertinoDynamicColor.withBrightness( |
|||
debugLabel: "inactiveGray", |
|||
color: new Color(0xFF999999), |
|||
darkColor: new Color(0xFF757575) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor destructiveRed = systemRed; |
|||
|
|||
public static readonly CupertinoDynamicColor systemBlue = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemBlue", |
|||
color: Color.fromARGB(255, 0, 122, 255), |
|||
darkColor: Color.fromARGB(255, 10, 132, 255), |
|||
highContrastColor: Color.fromARGB(255, 0, 64, 221), |
|||
darkHighContrastColor: Color.fromARGB(255, 64, 156, 255) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGreen = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGreen", |
|||
color: Color.fromARGB(255, 52, 199, 89), |
|||
darkColor: Color.fromARGB(255, 48, 209, 88), |
|||
highContrastColor: Color.fromARGB(255, 36, 138, 61), |
|||
darkHighContrastColor: Color.fromARGB(255, 48, 219, 91) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemIndigo = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemIndigo", |
|||
color: Color.fromARGB(255, 88, 86, 214), |
|||
darkColor: Color.fromARGB(255, 94, 92, 230), |
|||
highContrastColor: Color.fromARGB(255, 54, 52, 163), |
|||
darkHighContrastColor: Color.fromARGB(255, 125, 122, 255) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemOrange = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemOrange", |
|||
color: Color.fromARGB(255, 255, 149, 0), |
|||
darkColor: Color.fromARGB(255, 255, 159, 10), |
|||
highContrastColor: Color.fromARGB(255, 201, 52, 0), |
|||
darkHighContrastColor: Color.fromARGB(255, 255, 179, 64) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemPink = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemPink", |
|||
color: Color.fromARGB(255, 255, 45, 85), |
|||
darkColor: Color.fromARGB(255, 255, 55, 95), |
|||
highContrastColor: Color.fromARGB(255, 211, 15, 69), |
|||
darkHighContrastColor: Color.fromARGB(255, 255, 100, 130) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemPurple = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemPurple", |
|||
color: Color.fromARGB(255, 175, 82, 222), |
|||
darkColor: Color.fromARGB(255, 191, 90, 242), |
|||
highContrastColor: Color.fromARGB(255, 137, 68, 171), |
|||
darkHighContrastColor: Color.fromARGB(255, 218, 143, 255) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemRed = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemRed", |
|||
color: Color.fromARGB(255, 255, 59, 48), |
|||
darkColor: Color.fromARGB(255, 255, 69, 58), |
|||
highContrastColor: Color.fromARGB(255, 215, 0, 21), |
|||
darkHighContrastColor: Color.fromARGB(255, 255, 105, 97) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemTeal = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemTeal", |
|||
color: Color.fromARGB(255, 90, 200, 250), |
|||
darkColor: Color.fromARGB(255, 100, 210, 255), |
|||
highContrastColor: Color.fromARGB(255, 0, 113, 164), |
|||
darkHighContrastColor: Color.fromARGB(255, 112, 215, 255) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemYellow = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemYellow", |
|||
color: Color.fromARGB(255, 255, 204, 0), |
|||
darkColor: Color.fromARGB(255, 255, 214, 10), |
|||
highContrastColor: Color.fromARGB(255, 160, 90, 0), |
|||
darkHighContrastColor: Color.fromARGB(255, 255, 212, 38) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGrey = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGrey", |
|||
color: Color.fromARGB(255, 142, 142, 147), |
|||
darkColor: Color.fromARGB(255, 142, 142, 147), |
|||
highContrastColor: Color.fromARGB(255, 108, 108, 112), |
|||
darkHighContrastColor: Color.fromARGB(255, 174, 174, 178) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGrey2 = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGrey2", |
|||
color: Color.fromARGB(255, 174, 174, 178), |
|||
darkColor: Color.fromARGB(255, 99, 99, 102), |
|||
highContrastColor: Color.fromARGB(255, 142, 142, 147), |
|||
darkHighContrastColor: Color.fromARGB(255, 124, 124, 128) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGrey3 = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGrey3", |
|||
color: Color.fromARGB(255, 199, 199, 204), |
|||
darkColor: Color.fromARGB(255, 72, 72, 74), |
|||
highContrastColor: Color.fromARGB(255, 174, 174, 178), |
|||
darkHighContrastColor: Color.fromARGB(255, 84, 84, 86) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGrey4 = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGrey4", |
|||
color: Color.fromARGB(255, 209, 209, 214), |
|||
darkColor: Color.fromARGB(255, 58, 58, 60), |
|||
highContrastColor: Color.fromARGB(255, 188, 188, 192), |
|||
darkHighContrastColor: Color.fromARGB(255, 68, 68, 70) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGrey5 = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGrey5", |
|||
color: Color.fromARGB(255, 229, 229, 234), |
|||
darkColor: Color.fromARGB(255, 44, 44, 46), |
|||
highContrastColor: Color.fromARGB(255, 216, 216, 220), |
|||
darkHighContrastColor: Color.fromARGB(255, 54, 54, 56) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGrey6 = CupertinoDynamicColor.withBrightnessAndContrast( |
|||
debugLabel: "systemGrey6", |
|||
color: Color.fromARGB(255, 242, 242, 247), |
|||
darkColor: Color.fromARGB(255, 28, 28, 30), |
|||
highContrastColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastColor: Color.fromARGB(255, 36, 36, 38) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor label = new CupertinoDynamicColor( |
|||
debugLabel: "label", |
|||
effectiveColor:Color.fromARGB(255, 0, 0, 0), |
|||
color: Color.fromARGB(255, 0, 0, 0), |
|||
darkColor: Color.fromARGB(255, 255, 255, 255), |
|||
highContrastColor: Color.fromARGB(255, 0, 0, 0), |
|||
darkHighContrastColor: Color.fromARGB(255, 255, 255, 255), |
|||
elevatedColor: Color.fromARGB(255, 0, 0, 0), |
|||
darkElevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor secondaryLabel = new CupertinoDynamicColor( |
|||
debugLabel: "secondaryLabel", |
|||
effectiveColor:Color.fromARGB(153, 60, 60, 67), |
|||
color: Color.fromARGB(153, 60, 60, 67), |
|||
darkColor: Color.fromARGB(153, 235, 235, 245), |
|||
highContrastColor: Color.fromARGB(173, 60, 60, 67), |
|||
darkHighContrastColor: Color.fromARGB(173, 235, 235, 245), |
|||
elevatedColor: Color.fromARGB(153, 60, 60, 67), |
|||
darkElevatedColor: Color.fromARGB(153, 235, 235, 245), |
|||
highContrastElevatedColor: Color.fromARGB(173, 60, 60, 67), |
|||
darkHighContrastElevatedColor: Color.fromARGB(173, 235, 235, 245) |
|||
); |
|||
|
|||
/// The color for text labels containing tertiary content, equivalent to
|
|||
/// [UIColor.tertiaryLabel](https://developer.apple.com/documentation/uikit/uicolor/3173153-tertiarylabel).
|
|||
public static readonly CupertinoDynamicColor tertiaryLabel = new CupertinoDynamicColor( |
|||
debugLabel: "tertiaryLabel", |
|||
effectiveColor: Color.fromARGB(76, 60, 60, 67), |
|||
color: Color.fromARGB(76, 60, 60, 67), |
|||
darkColor: Color.fromARGB(76, 235, 235, 245), |
|||
highContrastColor: Color.fromARGB(96, 60, 60, 67), |
|||
darkHighContrastColor: Color.fromARGB(96, 235, 235, 245), |
|||
elevatedColor: Color.fromARGB(76, 60, 60, 67), |
|||
darkElevatedColor: Color.fromARGB(76, 235, 235, 245), |
|||
highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67), |
|||
darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor quaternaryLabel = new CupertinoDynamicColor( |
|||
debugLabel: "quaternaryLabel", |
|||
effectiveColor:Color.fromARGB(45, 60, 60, 67), |
|||
color: Color.fromARGB(45, 60, 60, 67), |
|||
darkColor: Color.fromARGB(40, 235, 235, 245), |
|||
highContrastColor: Color.fromARGB(66, 60, 60, 67), |
|||
darkHighContrastColor: Color.fromARGB(61, 235, 235, 245), |
|||
elevatedColor: Color.fromARGB(45, 60, 60, 67), |
|||
darkElevatedColor: Color.fromARGB(40, 235, 235, 245), |
|||
highContrastElevatedColor: Color.fromARGB(66, 60, 60, 67), |
|||
darkHighContrastElevatedColor: Color.fromARGB(61, 235, 235, 245) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemFill = new CupertinoDynamicColor( |
|||
debugLabel: "systemFill", |
|||
effectiveColor:Color.fromARGB(51, 120, 120, 128), |
|||
color: Color.fromARGB(51, 120, 120, 128), |
|||
darkColor: Color.fromARGB(91, 120, 120, 128), |
|||
highContrastColor: Color.fromARGB(71, 120, 120, 128), |
|||
darkHighContrastColor: Color.fromARGB(112, 120, 120, 128), |
|||
elevatedColor: Color.fromARGB(51, 120, 120, 128), |
|||
darkElevatedColor: Color.fromARGB(91, 120, 120, 128), |
|||
highContrastElevatedColor: Color.fromARGB(71, 120, 120, 128), |
|||
darkHighContrastElevatedColor: Color.fromARGB(112, 120, 120, 128) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor secondarySystemFill = new CupertinoDynamicColor( |
|||
debugLabel: "secondarySystemFill", |
|||
effectiveColor: Color.fromARGB(40, 120, 120, 128), |
|||
color: Color.fromARGB(40, 120, 120, 128), |
|||
darkColor: Color.fromARGB(81, 120, 120, 128), |
|||
highContrastColor: Color.fromARGB(61, 120, 120, 128), |
|||
darkHighContrastColor: Color.fromARGB(102, 120, 120, 128), |
|||
elevatedColor: Color.fromARGB(40, 120, 120, 128), |
|||
darkElevatedColor: Color.fromARGB(81, 120, 120, 128), |
|||
highContrastElevatedColor: Color.fromARGB(61, 120, 120, 128), |
|||
darkHighContrastElevatedColor: Color.fromARGB(102, 120, 120, 128) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor tertiarySystemFill = new CupertinoDynamicColor( |
|||
debugLabel: "tertiarySystemFill", |
|||
effectiveColor:Color.fromARGB(30, 118, 118, 128), |
|||
color: Color.fromARGB(30, 118, 118, 128), |
|||
darkColor: Color.fromARGB(61, 118, 118, 128), |
|||
highContrastColor: Color.fromARGB(51, 118, 118, 128), |
|||
darkHighContrastColor: Color.fromARGB(81, 118, 118, 128), |
|||
elevatedColor: Color.fromARGB(30, 118, 118, 128), |
|||
darkElevatedColor: Color.fromARGB(61, 118, 118, 128), |
|||
highContrastElevatedColor: Color.fromARGB(51, 118, 118, 128), |
|||
darkHighContrastElevatedColor: Color.fromARGB(81, 118, 118, 128) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor quaternarySystemFill = new CupertinoDynamicColor( |
|||
debugLabel: "quaternarySystemFill", |
|||
effectiveColor:Color.fromARGB(20, 116, 116, 128), |
|||
color: Color.fromARGB(20, 116, 116, 128), |
|||
darkColor: Color.fromARGB(45, 118, 118, 128), |
|||
highContrastColor: Color.fromARGB(40, 116, 116, 128), |
|||
darkHighContrastColor: Color.fromARGB(66, 118, 118, 128), |
|||
elevatedColor: Color.fromARGB(20, 116, 116, 128), |
|||
darkElevatedColor: Color.fromARGB(45, 118, 118, 128), |
|||
highContrastElevatedColor: Color.fromARGB(40, 116, 116, 128), |
|||
darkHighContrastElevatedColor: Color.fromARGB(66, 118, 118, 128) |
|||
); |
|||
|
|||
/// The color for placeholder text in controls or text views, equivalent to
|
|||
/// [UIColor.placeholderText](https://developer.apple.com/documentation/uikit/uicolor/3173134-placeholdertext).
|
|||
public static readonly CupertinoDynamicColor placeholderText = new CupertinoDynamicColor( |
|||
debugLabel: "placeholderText", |
|||
effectiveColor:Color.fromARGB(76, 60, 60, 67), |
|||
color: Color.fromARGB(76, 60, 60, 67), |
|||
darkColor: Color.fromARGB(76, 235, 235, 245), |
|||
highContrastColor: Color.fromARGB(96, 60, 60, 67), |
|||
darkHighContrastColor: Color.fromARGB(96, 235, 235, 245), |
|||
elevatedColor: Color.fromARGB(76, 60, 60, 67), |
|||
darkElevatedColor: Color.fromARGB(76, 235, 235, 245), |
|||
highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67), |
|||
darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemBackground = new CupertinoDynamicColor( |
|||
debugLabel: "systemBackground", |
|||
effectiveColor:Color.fromARGB(255, 255, 255, 255), |
|||
color: Color.fromARGB(255, 255, 255, 255), |
|||
darkColor: Color.fromARGB(255, 0, 0, 0), |
|||
highContrastColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkHighContrastColor: Color.fromARGB(255, 0, 0, 0), |
|||
elevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkElevatedColor: Color.fromARGB(255, 28, 28, 30), |
|||
highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor secondarySystemBackground = new CupertinoDynamicColor( |
|||
debugLabel: "secondarySystemBackground", |
|||
effectiveColor:Color.fromARGB(255, 242, 242, 247), |
|||
color: Color.fromARGB(255, 242, 242, 247), |
|||
darkColor: Color.fromARGB(255, 28, 28, 30), |
|||
highContrastColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), |
|||
elevatedColor: Color.fromARGB(255, 242, 242, 247), |
|||
darkElevatedColor: Color.fromARGB(255, 44, 44, 46), |
|||
highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor tertiarySystemBackground = new CupertinoDynamicColor( |
|||
debugLabel: "tertiarySystemBackground", |
|||
effectiveColor:Color.fromARGB(255, 255, 255, 255), |
|||
color: Color.fromARGB(255, 255, 255, 255), |
|||
darkColor: Color.fromARGB(255, 44, 44, 46), |
|||
highContrastColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), |
|||
elevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkElevatedColor: Color.fromARGB(255, 58, 58, 60), |
|||
highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor systemGroupedBackground = new CupertinoDynamicColor( |
|||
debugLabel: "systemGroupedBackground", |
|||
effectiveColor:Color.fromARGB(255, 242, 242, 247), |
|||
color: Color.fromARGB(255, 242, 242, 247), |
|||
darkColor: Color.fromARGB(255, 0, 0, 0), |
|||
highContrastColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastColor: Color.fromARGB(255, 0, 0, 0), |
|||
elevatedColor: Color.fromARGB(255, 242, 242, 247), |
|||
darkElevatedColor: Color.fromARGB(255, 28, 28, 30), |
|||
highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor secondarySystemGroupedBackground = new CupertinoDynamicColor( |
|||
debugLabel: "secondarySystemGroupedBackground", |
|||
effectiveColor:Color.fromARGB(255, 255, 255, 255), |
|||
color: Color.fromARGB(255, 255, 255, 255), |
|||
darkColor: Color.fromARGB(255, 28, 28, 30), |
|||
highContrastColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), |
|||
elevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkElevatedColor: Color.fromARGB(255, 44, 44, 46), |
|||
highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor tertiarySystemGroupedBackground = new CupertinoDynamicColor( |
|||
debugLabel: "tertiarySystemGroupedBackground", |
|||
effectiveColor:Color.fromARGB(255, 242, 242, 247), |
|||
color: Color.fromARGB(255, 242, 242, 247), |
|||
darkColor: Color.fromARGB(255, 44, 44, 46), |
|||
highContrastColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), |
|||
elevatedColor: Color.fromARGB(255, 242, 242, 247), |
|||
darkElevatedColor: Color.fromARGB(255, 58, 58, 60), |
|||
highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor separator = new CupertinoDynamicColor( |
|||
debugLabel: "separator", |
|||
effectiveColor:Color.fromARGB(73, 60, 60, 67), |
|||
color: Color.fromARGB(73, 60, 60, 67), |
|||
darkColor: Color.fromARGB(153, 84, 84, 88), |
|||
highContrastColor: Color.fromARGB(94, 60, 60, 67), |
|||
darkHighContrastColor: Color.fromARGB(173, 84, 84, 88), |
|||
elevatedColor: Color.fromARGB(73, 60, 60, 67), |
|||
darkElevatedColor: Color.fromARGB(153, 84, 84, 88), |
|||
highContrastElevatedColor: Color.fromARGB(94, 60, 60, 67), |
|||
darkHighContrastElevatedColor: Color.fromARGB(173, 84, 84, 88) |
|||
); |
|||
|
|||
/// The color for borders or divider lines that hide any underlying content,
|
|||
/// equivalent to [UIColor.opaqueSeparator](https://developer.apple.com/documentation/uikit/uicolor/3173133-opaqueseparator).
|
|||
public static readonly CupertinoDynamicColor opaqueSeparator = new CupertinoDynamicColor( |
|||
debugLabel: "opaqueSeparator", |
|||
effectiveColor:Color.fromARGB(255, 198, 198, 200), |
|||
color: Color.fromARGB(255, 198, 198, 200), |
|||
darkColor: Color.fromARGB(255, 56, 56, 58), |
|||
highContrastColor: Color.fromARGB(255, 198, 198, 200), |
|||
darkHighContrastColor: Color.fromARGB(255, 56, 56, 58), |
|||
elevatedColor: Color.fromARGB(255, 198, 198, 200), |
|||
darkElevatedColor: Color.fromARGB(255, 56, 56, 58), |
|||
highContrastElevatedColor: Color.fromARGB(255, 198, 198, 200), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 56, 56, 58) |
|||
); |
|||
|
|||
public static readonly CupertinoDynamicColor link = |
|||
new CupertinoDynamicColor( |
|||
debugLabel: "link", |
|||
effectiveColor:Color.fromARGB(255, 0, 122, 255), |
|||
color: Color.fromARGB(255, 0, 122, 255), |
|||
darkColor: Color.fromARGB(255, 9, 132, 255), |
|||
highContrastColor: Color.fromARGB(255, 0, 122, 255), |
|||
darkHighContrastColor: Color.fromARGB(255, 9, 132, 255), |
|||
elevatedColor: Color.fromARGB(255, 0, 122, 255), |
|||
darkElevatedColor: Color.fromARGB(255, 9, 132, 255), |
|||
highContrastElevatedColor: Color.fromARGB(255, 0, 122, 255), |
|||
darkHighContrastElevatedColor: Color.fromARGB(255, 9, 132, 255) |
|||
); |
|||
} |
|||
public static readonly Color activeGreen = new Color(0xFF4CD964); |
|||
public class CupertinoDynamicColor : DiagnosticableMixinColor { |
|||
public CupertinoDynamicColor( |
|||
string debugLabel = null, |
|||
Color effectiveColor = null, |
|||
Color color = null, |
|||
Color darkColor = null, |
|||
Color highContrastColor = null, |
|||
Color darkHighContrastColor = null, |
|||
Color elevatedColor = null, |
|||
Color darkElevatedColor = null, |
|||
Color highContrastElevatedColor = null, |
|||
Color darkHighContrastElevatedColor = null, |
|||
Element debugResolveContext = null |
|||
): base(0) |
|||
{ |
|||
D.assert(color != null,()=>"color8 == null"); |
|||
D.assert(darkColor != null,()=>"color7 == null"); |
|||
D.assert(highContrastColor != null,()=>"color6 == null"); |
|||
D.assert(darkHighContrastColor != null,()=>"color5 == null"); |
|||
D.assert(elevatedColor != null,()=>"color4 == null"); |
|||
D.assert(darkElevatedColor != null,()=>"color3 == null"); |
|||
D.assert(highContrastElevatedColor != null,()=>"color2 == null"); |
|||
D.assert(darkHighContrastElevatedColor != null,()=>"color1 == null"); |
|||
|
|||
public static readonly Color activeOrange = new Color(0xFFFF9500); |
|||
_effectiveColor = effectiveColor ?? color; |
|||
this.color = color; |
|||
this.darkColor = darkColor; |
|||
this.highContrastColor = highContrastColor; |
|||
this.darkHighContrastColor = darkHighContrastColor; |
|||
this.elevatedColor = elevatedColor; |
|||
this.darkElevatedColor = darkElevatedColor; |
|||
this.highContrastElevatedColor = highContrastElevatedColor; |
|||
this.darkHighContrastElevatedColor = darkHighContrastElevatedColor; |
|||
_debugResolveContext = debugResolveContext; |
|||
_debugLabel = debugLabel; |
|||
} |
|||
public static readonly Color white = new Color(0xFFFFFFFF); |
|||
|
|||
public static readonly Color black = new Color(0xFF000000); |
|||
public static CupertinoDynamicColor withBrightnessAndContrast( |
|||
string debugLabel , |
|||
Color color , |
|||
Color darkColor , |
|||
Color highContrastColor , |
|||
Color darkHighContrastColor |
|||
) { |
|||
return new CupertinoDynamicColor( |
|||
debugLabel: debugLabel, |
|||
color: color, |
|||
darkColor: darkColor, |
|||
highContrastColor: highContrastColor, |
|||
darkHighContrastColor: darkHighContrastColor, |
|||
elevatedColor: color, |
|||
darkElevatedColor: darkColor, |
|||
highContrastElevatedColor: highContrastColor, |
|||
darkHighContrastElevatedColor: darkHighContrastColor, |
|||
debugResolveContext: null |
|||
); |
|||
} |
|||
public static readonly Color lightBackgroundGray = new Color(0xFFE5E5EA); |
|||
public static CupertinoDynamicColor withBrightness( |
|||
string debugLabel = null, |
|||
Color color = null, |
|||
Color darkColor = null |
|||
) { |
|||
return new CupertinoDynamicColor( |
|||
debugLabel: debugLabel, |
|||
color: color, |
|||
darkColor: darkColor, |
|||
highContrastColor: color, |
|||
darkHighContrastColor: darkColor, |
|||
elevatedColor: color, |
|||
darkElevatedColor: darkColor, |
|||
highContrastElevatedColor: color, |
|||
darkHighContrastElevatedColor: darkColor, |
|||
debugResolveContext: null |
|||
); |
|||
} |
|||
public static readonly Color extraLightBackgroundGray = new Color(0xFFEFEFF4); |
|||
public readonly Color _effectiveColor; |
|||
public new uint value { |
|||
get { |
|||
return _effectiveColor.value; |
|||
} |
|||
} |
|||
public static readonly Color darkBackgroundGray = new Color(0xFF171717); |
|||
public static readonly Color inactiveGray = new Color(0xFF8E8E93); |
|||
public readonly string _debugLabel; |
|||
public readonly Element _debugResolveContext; |
|||
|
|||
public readonly Color color; |
|||
public static readonly Color destructiveRed = new Color(0xFFFF3B30); |
|||
public readonly Color darkColor; |
|||
|
|||
public readonly Color highContrastColor; |
|||
public readonly Color darkHighContrastColor; |
|||
|
|||
public readonly Color elevatedColor; |
|||
|
|||
public readonly Color darkElevatedColor; |
|||
public readonly Color highContrastElevatedColor; |
|||
public readonly Color darkHighContrastElevatedColor; |
|||
|
|||
|
|||
public static Color resolve(Color resolvable, BuildContext context, bool nullOk = true) { |
|||
if (resolvable == null) |
|||
return null; |
|||
D.assert(context != null); |
|||
|
|||
|
|||
//var resolveColor = (resolvable is CupertinoDynamicColor) ? ((CupertinoDynamicColor)resolvable).resolveFrom(context, nullOk: nullOk) : resolvable;
|
|||
Color resolveColor = null; |
|||
if (resolvable is CupertinoDynamicColor) { |
|||
int i = 0; |
|||
resolveColor = ((CupertinoDynamicColor) resolvable).resolveFrom(context, nullOk: nullOk)._effectiveColor; |
|||
} |
|||
else { |
|||
int j = 0; |
|||
resolveColor = resolvable; |
|||
} |
|||
|
|||
return resolveColor; |
|||
} |
|||
|
|||
public bool _isPlatformBrightnessDependent { |
|||
get { |
|||
return color != darkColor |
|||
|| elevatedColor != darkElevatedColor |
|||
|| highContrastColor != darkHighContrastColor |
|||
|| highContrastElevatedColor != darkHighContrastElevatedColor; |
|||
} |
|||
|
|||
} |
|||
|
|||
public bool _isHighContrastDependent { |
|||
get { |
|||
return color != highContrastColor |
|||
|| darkColor != darkHighContrastColor |
|||
|| elevatedColor != highContrastElevatedColor |
|||
|| darkElevatedColor != darkHighContrastElevatedColor; |
|||
} |
|||
} |
|||
|
|||
public bool _isInterfaceElevationDependent { |
|||
get { |
|||
return color != elevatedColor |
|||
|| darkColor != darkElevatedColor |
|||
|| highContrastColor != highContrastElevatedColor |
|||
|| darkHighContrastColor != darkHighContrastElevatedColor; |
|||
} |
|||
} |
|||
|
|||
public CupertinoDynamicColor resolveFrom(BuildContext context, bool nullOk = true) { |
|||
|
|||
Brightness brightness = _isPlatformBrightnessDependent |
|||
? CupertinoTheme.brightnessOf(context, nullOk: nullOk) ?? Brightness.light |
|||
: Brightness.light; |
|||
|
|||
bool isHighContrastEnabled = _isHighContrastDependent |
|||
&& (MediaQuery.of(context, nullOk: nullOk)?.highContrast ?? false); |
|||
|
|||
CupertinoUserInterfaceLevelData level = _isInterfaceElevationDependent |
|||
? CupertinoUserInterfaceLevel.of(context, nullOk: nullOk) ?? CupertinoUserInterfaceLevelData.baselayer |
|||
: CupertinoUserInterfaceLevelData.baselayer; |
|||
|
|||
Color resolved = null; |
|||
switch (brightness) { |
|||
case Brightness.light: |
|||
switch (level) { |
|||
case CupertinoUserInterfaceLevelData.baselayer: |
|||
resolved = isHighContrastEnabled ? highContrastColor : color; |
|||
break; |
|||
case CupertinoUserInterfaceLevelData.elevatedlayer: |
|||
resolved = isHighContrastEnabled ? highContrastElevatedColor : elevatedColor; |
|||
break; |
|||
} |
|||
|
|||
break; |
|||
case Brightness.dark: |
|||
switch (level) { |
|||
case CupertinoUserInterfaceLevelData.baselayer: |
|||
resolved = isHighContrastEnabled ? darkHighContrastColor : darkColor; |
|||
break; |
|||
case CupertinoUserInterfaceLevelData.elevatedlayer: |
|||
resolved = isHighContrastEnabled ? darkHighContrastElevatedColor : darkElevatedColor; |
|||
break; |
|||
} |
|||
|
|||
break; |
|||
} |
|||
|
|||
Element _debugContext = null; |
|||
D.assert(() => { |
|||
_debugContext = context as Element; |
|||
return true; |
|||
} |
|||
); |
|||
|
|||
return new CupertinoDynamicColor( |
|||
debugLabel: _debugLabel, |
|||
effectiveColor: resolved, |
|||
color: color, |
|||
darkColor: darkColor, |
|||
highContrastColor: highContrastColor, |
|||
darkHighContrastColor: darkHighContrastColor, |
|||
elevatedColor: color, |
|||
darkElevatedColor: darkColor, |
|||
highContrastElevatedColor: highContrastColor, |
|||
darkHighContrastElevatedColor: darkHighContrastColor, |
|||
debugResolveContext: null |
|||
); |
|||
} |
|||
|
|||
public bool Equals(CupertinoDynamicColor other) { |
|||
if (ReferenceEquals(null, other)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, other)) { |
|||
return true; |
|||
} |
|||
|
|||
return Equals(value, other.value) |
|||
&& Equals(color, other.color) |
|||
&& Equals(darkColor, other.darkColor) |
|||
&& Equals(highContrastColor, other.highContrastColor) |
|||
&& Equals(darkHighContrastColor, other.darkHighContrastColor) |
|||
&& Equals(elevatedColor, other.elevatedColor) |
|||
&& Equals(darkElevatedColor, other.darkElevatedColor) |
|||
&& Equals(highContrastElevatedColor, other.highContrastElevatedColor) |
|||
&& Equals(darkHighContrastElevatedColor, other.darkHighContrastElevatedColor); |
|||
} |
|||
|
|||
public override bool Equals(object obj) { |
|||
|
|||
if (ReferenceEquals(null, obj)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, obj)) { |
|||
return true; |
|||
} |
|||
|
|||
if (obj.GetType() != GetType()) { |
|||
return false; |
|||
} |
|||
|
|||
return Equals((CupertinoDynamicColor) obj); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
var hashCode = (value != null ? value.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^(color != null ? color.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (darkColor != null ? darkColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (highContrastColor != null ? highContrastColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (elevatedColor != null ? elevatedColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (darkElevatedColor != null ? darkElevatedColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (darkHighContrastColor != null ? darkHighContrastColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (darkHighContrastElevatedColor != null |
|||
? darkHighContrastElevatedColor.GetHashCode() |
|||
: 0); |
|||
hashCode = (hashCode * 397) ^ |
|||
(highContrastElevatedColor != null ? highContrastElevatedColor.GetHashCode() : 0); |
|||
return hashCode; |
|||
} |
|||
|
|||
} |
|||
|
|||
public static bool operator ==(CupertinoDynamicColor left, CupertinoDynamicColor right) { |
|||
return Equals(left, right); |
|||
} |
|||
|
|||
public static bool operator !=(CupertinoDynamicColor left, CupertinoDynamicColor right) { |
|||
return !Equals(left, right); |
|||
} |
|||
|
|||
public override string ToString() { |
|||
return toString(); |
|||
} |
|||
|
|||
public override string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) { |
|||
string toStringColor(string name, Color color) { |
|||
string marker = color == _effectiveColor ? "*" : ""; |
|||
return marker+ name+" = " + color + marker; |
|||
} |
|||
List<string> xs = new List<string>(); |
|||
xs.Add(toStringColor("color",color)); |
|||
if (_isPlatformBrightnessDependent) |
|||
xs.Add(toStringColor("darkColor", darkColor)); |
|||
if (_isHighContrastDependent) |
|||
xs.Add( toStringColor("highContrastColor", highContrastColor)); |
|||
if (_isPlatformBrightnessDependent && _isHighContrastDependent) |
|||
xs.Add(toStringColor("darkHighContrastColor", darkHighContrastColor)); |
|||
if (_isInterfaceElevationDependent) |
|||
xs.Add( toStringColor("elevatedColor", elevatedColor)); |
|||
if (_isPlatformBrightnessDependent && _isInterfaceElevationDependent) |
|||
xs.Add(toStringColor("darkElevatedColor", darkElevatedColor)); |
|||
if (_isHighContrastDependent && _isInterfaceElevationDependent) |
|||
xs.Add(toStringColor("highContrastElevatedColor", highContrastElevatedColor)); |
|||
if (_isPlatformBrightnessDependent && _isHighContrastDependent && _isInterfaceElevationDependent) |
|||
xs.Add(toStringColor("darkHighContrastElevatedColor", darkHighContrastElevatedColor)); |
|||
|
|||
string xsStr = ""; |
|||
foreach (var xss in xs) { |
|||
xsStr += xss; |
|||
} |
|||
var debugContext = _debugResolveContext?.widget; |
|||
if (_debugResolveContext?.widget == null) { |
|||
return $"[{_debugLabel ?? GetType().ToString()}({xsStr}, resolved by: UNRESOLVED)]"; |
|||
} |
|||
else { |
|||
return $"[{_debugLabel ?? GetType().ToString()}({xsStr}, resolved by: {_debugResolveContext?.widget })]"; |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
if (_debugLabel != null) |
|||
properties.add(new MessageProperty("debugLabel", _debugLabel)); |
|||
properties.add(createCupertinoColorProperty("color", color)); |
|||
if (_isPlatformBrightnessDependent) |
|||
properties.add(createCupertinoColorProperty("darkColor", darkColor)); |
|||
if (_isHighContrastDependent) |
|||
properties.add(createCupertinoColorProperty("highContrastColor", highContrastColor)); |
|||
if (_isPlatformBrightnessDependent && _isHighContrastDependent) |
|||
properties.add(createCupertinoColorProperty("darkHighContrastColor", darkHighContrastColor)); |
|||
if (_isInterfaceElevationDependent) |
|||
properties.add(createCupertinoColorProperty("elevatedColor", elevatedColor)); |
|||
if (_isPlatformBrightnessDependent && _isInterfaceElevationDependent) |
|||
properties.add(createCupertinoColorProperty("darkElevatedColor", darkElevatedColor)); |
|||
if (_isHighContrastDependent && _isInterfaceElevationDependent) |
|||
properties.add(createCupertinoColorProperty("highContrastElevatedColor", highContrastElevatedColor)); |
|||
if (_isPlatformBrightnessDependent && _isHighContrastDependent && _isInterfaceElevationDependent) |
|||
properties.add(createCupertinoColorProperty("darkHighContrastElevatedColor", |
|||
darkHighContrastElevatedColor)); |
|||
|
|||
if (_debugResolveContext != null) |
|||
properties.add(new DiagnosticsProperty<Element>("last resolved", _debugResolveContext)); |
|||
|
|||
} |
|||
|
|||
public static DiagnosticsProperty<Color> createCupertinoColorProperty( |
|||
string name , |
|||
Color value , |
|||
bool showName = true, |
|||
object defaultValue = null, |
|||
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, |
|||
DiagnosticLevel level = DiagnosticLevel.info |
|||
) { |
|||
|
|||
if (value is CupertinoDynamicColor) { |
|||
return new DiagnosticsProperty<Color>( |
|||
name: name, |
|||
value: value, |
|||
description: ((CupertinoDynamicColor)value)._debugLabel, |
|||
showName: showName, |
|||
defaultValue: defaultValue, |
|||
style: style, |
|||
level: level |
|||
); |
|||
} |
|||
else { |
|||
return new ColorProperty( |
|||
name, |
|||
value, |
|||
showName: showName, |
|||
defaultValue: defaultValue, |
|||
style: style, |
|||
level: level |
|||
); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue