temporary changes
This commit is contained in:
Родитель
1a09b5e4bc
Коммит
77945b0b2f
|
@ -8,6 +8,7 @@
|
|||
<Path>Library/PackageCache/com.unity.ide.rider@1.1.4</Path>
|
||||
<Path>Library/PackageCache/com.unity.ide.vscode@1.2.1</Path>
|
||||
<Path>Library/PackageCache/com.unity.test-framework@1.1.14</Path>
|
||||
<Path>Library/PackageCache/com.unity.test-framework@1.1.16</Path>
|
||||
<Path>Library/PackageCache/com.unity.textmeshpro@2.0.1</Path>
|
||||
<Path>Library/PackageCache/com.unity.timeline@1.2.15</Path>
|
||||
<Path>Packages</Path>
|
||||
|
@ -18,6 +19,7 @@
|
|||
<Path>.idea</Path>
|
||||
<Path>.vs</Path>
|
||||
<Path>Library</Path>
|
||||
<Path>Logs</Path>
|
||||
<Path>Temp</Path>
|
||||
<Path>obj</Path>
|
||||
</explicitExcludes>
|
||||
|
|
|
@ -1,5 +1,215 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BranchesTreeState">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:pr" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:shiyun" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:siyaoH" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:sywen" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:github-desktop-finnif" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:github-desktop-finnif" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:1.17.4" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:github-desktop-finnif" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:shiyun" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:github-desktop-finnif" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:siyaoH" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:github-desktop-finnif" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:zxw" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:1.17.4" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:shiyun" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:siyaoH" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:sywen" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="GROUP_NODE:zxw" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4a820c96-d7cc-45d3-aad5-43ed8e63fac6" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.UIWidgetsSamples_2019_4/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.UIWidgetsSamples_2019_4/.idea/contentModel.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.UIWidgetsSamples_2019_4/.idea/indexLayout.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.UIWidgetsSamples_2019_4/.idea/indexLayout.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.UIWidgetsSamples_2019_4/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.UIWidgetsSamples_2019_4/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/Plugins/x86_64/libUIWidgets_d.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Plugins/x86_64/libUIWidgets_d.dll" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/UIWidgetsExample.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UIWidgetsExample.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/UIWidgetsGallery/GalleryMain.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UIWidgetsGallery/GalleryMain.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/UIWidgetsGallery/demo/cupertino/cupertino_picker_demo.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UIWidgetsGallery/demo/cupertino/cupertino_picker_demo.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/UIWidgetsGallery/demo/cupertino/cupertino_text_field_demo.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UIWidgetsGallery/demo/cupertino/cupertino_text_field_demo.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Packages/manifest.json" beforeDir="false" afterPath="$PROJECT_DIR$/Packages/manifest.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Packages/packages-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/Packages/packages-lock.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ProjectSettings/ProjectVersion.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ProjectSettings/ProjectVersion.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/app.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/app.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/app.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/app.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/bottom_app_bar.cs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/bottom_app_bar.cs.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/button.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/button.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/button.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/button.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/color.cs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/color.cs.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/date_picker.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/date_picker.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/date_picker.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/date_picker.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/dialog.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/dialog.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/dialog.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/dialog.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/icons.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/icons.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/localization.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/localization.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/localization.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/localization.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/picker.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/picker.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/route.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/route.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/route.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/route.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/scrollbar.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/scrollbar.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/scrollbar.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/scrollbar.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/slider.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/slider.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/switch.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/switch.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/tab_scaffold.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/tab_scaffold.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/tab_view.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/tab_view.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/tab_view.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/tab_view.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_field.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_field.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_selection.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_selection.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_theme.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_theme.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_theme.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_theme.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/theme.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/theme.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/theme.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/theme.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/thumb_painter.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/thumb_painter.cs.meta" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/ui2/geometry.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/ui2/geometry.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/app.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/app.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/navigator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/navigator.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/routes.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/routes.cs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
||||
</component>
|
||||
<component name="HighlightingSettingsPerFile">
|
||||
<setting file="file://$USER_HOME$/unity/Modules/UI/ScriptBindings/UICanvas.bindings.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/FB001E01-371B-4ADC-A200-13E0AC763896/74/b128d6d4/List`1.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/context_menu.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/63DD8BF9-8CFA-4BA9-85AF-735EF1A56BA9/4f/053d4227/Dictionary`2.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/FB001E01-371B-4ADC-A200-13E0AC763896/65/03a6f5b0/Dictionary`2.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/Assets/UIWidgetsGallery/GalleryMain.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs" />
|
||||
<option value="$PROJECT_DIR$/Assets/UIWidgetsGallery/demo/cupertino/cupertino_picker_demo.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/date_picker.cs" />
|
||||
<option value="$PROJECT_DIR$/Assets/UIWidgetsExample.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/ui2/geometry.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs" />
|
||||
<option value="$PROJECT_DIR$/Assets/UIWidgetsGallery/demo/cupertino/cupertino_text_field_demo.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/text_field.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/cupertino/app.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/navigator.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/app.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/focus_manager.cs" />
|
||||
<option value="$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/widgets/routes.cs" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectId" id="1kmB1s8KNEyD9iXKH8ltaQLcb86" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="autoscrollFromSource" value="true" />
|
||||
<option name="autoscrollToSource" value="true" />
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.19385515" />
|
||||
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.16532554" />
|
||||
<property name="Discover.Launch.Via.Unity" value="true" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="XThreadsFramesViewSplitterKey" value="0.36055276" />
|
||||
<property name="dart.analysis.tool.window.visible" value="false" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
||||
<property name="vue.rearranger.settings.migration" value="true" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Attach to Unity Editor.Attach to Unity Editor">
|
||||
<configuration name="Attach to Unity Editor & Play" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="UNITY_ATTACH_AND_PLAY" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost">
|
||||
<option name="allowRunningInParallel" value="false" />
|
||||
|
@ -20,4 +230,199 @@
|
|||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="4a820c96-d7cc-45d3-aad5-43ed8e63fac6" name="Default Changelist" comment="" />
|
||||
<created>1606295678220</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1606295678220</updated>
|
||||
<workItem from="1606295687928" duration="6985000" />
|
||||
<workItem from="1606360579356" duration="22160000" />
|
||||
<workItem from="1606444700279" duration="9370000" />
|
||||
<workItem from="1606464930234" duration="6394000" />
|
||||
<workItem from="1606706404779" duration="9480000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="UnityProjectConfiguration" hasMinimizedUI="true" />
|
||||
<component name="UnityUnitTestConfiguration" currentTestLauncher="EditMode" />
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="oldMeFiltersMigrated" value="true" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.bottom" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.bottom/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.center" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.center/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.left" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.left/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.right" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.0.right/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.bottom" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.bottom/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.center" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.center/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.left" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.left/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.right" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.1.right/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.bottom" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.bottom/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.center" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.center/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.left" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.left/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.right" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.2.right/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.bottom" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.bottom/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.center" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.center/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.left" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.left/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.right" timestamp="1606389410345">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="1398" height="178" key="GridCell.Tab.3.right/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606389410345" />
|
||||
<state x="46" y="89" key="SettingsEditor" timestamp="1606300548918">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state x="46" y="89" key="SettingsEditor/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606300548918" />
|
||||
<state width="498" height="446" key="SwitcherDM" timestamp="1606721077591">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state width="498" height="446" key="SwitcherDM/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606721077591" />
|
||||
<state x="390" y="182" width="672" height="678" key="search.everywhere.popup" timestamp="1606380932000">
|
||||
<screen x="0" y="0" width="1440" height="860" />
|
||||
</state>
|
||||
<state x="390" y="182" width="672" height="678" key="search.everywhere.popup/0.0.1440.860/-3840.-348.1920.1040@0.0.1440.860" timestamp="1606380932000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/async2/schedule_microtask.cs</url>
|
||||
<line>137</line>
|
||||
<properties documentPath="C:\com.unity.uiwidgets\com.unity.uiwidgets\Runtime\async2\schedule_microtask.cs" initialLine="137">
|
||||
<startOffsets>
|
||||
<option value="5062" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="5085" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="3" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/rendering/editable.cs</url>
|
||||
<line>1058</line>
|
||||
<properties documentPath="C:\com.unity.uiwidgets\com.unity.uiwidgets\Runtime\rendering\editable.cs" initialLine="1058">
|
||||
<startOffsets>
|
||||
<option value="36052" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="36094" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="10" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/rendering/editable.cs</url>
|
||||
<line>1100</line>
|
||||
<properties documentPath="C:\com.unity.uiwidgets\com.unity.uiwidgets\Runtime\rendering\editable.cs" initialLine="1100">
|
||||
<startOffsets>
|
||||
<option value="37353" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="37387" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="11" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/rendering/editable.cs</url>
|
||||
<line>1120</line>
|
||||
<properties documentPath="C:\com.unity.uiwidgets\com.unity.uiwidgets\Runtime\rendering\editable.cs" initialLine="1120">
|
||||
<startOffsets>
|
||||
<option value="38309" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="38361" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="13" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/rendering/editable.cs</url>
|
||||
<line>1111</line>
|
||||
<properties documentPath="C:\com.unity.uiwidgets\com.unity.uiwidgets\Runtime\rendering\editable.cs" initialLine="1111">
|
||||
<startOffsets>
|
||||
<option value="37913" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="37976" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="14" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/../../com.unity.uiwidgets/Runtime/async2/timer.cs</url>
|
||||
<line>117</line>
|
||||
<properties documentPath="C:\com.unity.uiwidgets\com.unity.uiwidgets\Runtime\async2\timer.cs" initialLine="117">
|
||||
<startOffsets>
|
||||
<option value="3795" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="3844" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="22" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
|
@ -11,7 +11,12 @@ using Unity.UIWidgets.cupertino;
|
|||
using Unity.UIWidgets.rendering;
|
||||
//using UIWidgetsGallery.gallery;
|
||||
using Unity.UIWidgets.service;
|
||||
|
||||
using Brightness = Unity.UIWidgets.ui.Brightness;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UIWidgetsGallery.gallery;
|
||||
using Color = Unity.UIWidgets.ui.Color;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace UIWidgetsSample
|
||||
{
|
||||
|
@ -28,401 +33,222 @@ namespace UIWidgetsSample
|
|||
}
|
||||
|
||||
class MyApp : StatelessWidget
|
||||
{
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
return new CupertinoApp(
|
||||
home: new HomeScreen()
|
||||
);
|
||||
/*return new WidgetsApp(
|
||||
home: new HomeScreen(),
|
||||
|
||||
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
|
||||
new PageRouteBuilder(
|
||||
settings: settings,
|
||||
pageBuilder: (BuildContext Buildcontext, Animation<float> animation,
|
||||
Animation<float> secondaryAnimation) => builder(context)
|
||||
)
|
||||
);*/
|
||||
|
||||
}
|
||||
}
|
||||
{
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
return new CupertinoApp(
|
||||
home: new HomeScreen()
|
||||
);
|
||||
|
||||
|
||||
|
||||
class HomeScreen : StatelessWidget
|
||||
{
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
/*return new CupertinoPageScaffold(
|
||||
child: new Center(
|
||||
child: new Text("hello world!",
|
||||
style: CupertinoTheme.of(context).textTheme.navTitleTextStyle)
|
||||
),
|
||||
backgroundColor: Colors.brown
|
||||
);*/
|
||||
|
||||
List<BottomNavigationBarItem> items = new List<BottomNavigationBarItem>();
|
||||
items.Add( new BottomNavigationBarItem(
|
||||
icon: new Icon(CupertinoIcons.bell),
|
||||
title: new Text("views")
|
||||
));
|
||||
items.Add(new BottomNavigationBarItem(
|
||||
icon: new Icon(CupertinoIcons.eye_solid),
|
||||
title: new Text("articles")
|
||||
));
|
||||
return new CupertinoTabScaffold(
|
||||
tabBar: new CupertinoTabBar(
|
||||
items: items
|
||||
),
|
||||
tabBuilder: ((contex, index) =>
|
||||
{
|
||||
//return new Center(child: new Text("hello"));
|
||||
return new CupertinoTabView(
|
||||
builder:(contex1) =>
|
||||
{
|
||||
return new CupertinoPageScaffold(
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
middle:(index==0)? new Text("views") : new Text("articles")
|
||||
),
|
||||
child: new Center(
|
||||
/*child: new Text(
|
||||
"THIS IS TAB #" + index,
|
||||
style: CupertinoTheme.of(contex1)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
//.copyWith(fontSize:32)
|
||||
)*/
|
||||
child: new CupertinoButton(
|
||||
child: new Text(
|
||||
"THIS IS TAB #",
|
||||
style: CupertinoTheme.of(contex1)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
//.copyWith(fontSize:32)
|
||||
),
|
||||
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.of(contex1).push(
|
||||
new CupertinoPageRoute(builder: (contex3) =>
|
||||
{
|
||||
return
|
||||
new DetailScreen1(index==0? "views" : "articles" );
|
||||
})
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
})
|
||||
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class DetailScreen1 : StatelessWidget
|
||||
{
|
||||
public DetailScreen1(string topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
|
||||
}
|
||||
|
||||
public string topic;
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
return new CupertinoPageScaffold(
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
//middle: new Text("Details")
|
||||
),
|
||||
child: new Center(
|
||||
child: new Text("hello world")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
public class DetailScreen : StatefulWidget
|
||||
{
|
||||
public DetailScreen(string topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
}
|
||||
public string topic;
|
||||
|
||||
|
||||
public override State createState()
|
||||
{
|
||||
return new DetailScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
public class DetailScreenState : State<DetailScreen>
|
||||
{
|
||||
public bool switchValue = false;
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
var widgets = new List<Widget>();
|
||||
widgets.Add( new Expanded(child : new Text("a switch")));
|
||||
widgets.Add(new CupertinoSwitch(
|
||||
value: switchValue,
|
||||
onChanged: value =>
|
||||
{
|
||||
setState(() => switchValue = value);
|
||||
}
|
||||
));
|
||||
var rowWidgtes = new List<Widget>();
|
||||
var row = new Row(children:widgets);
|
||||
//rowWidgtes.Add(row);
|
||||
|
||||
var cupBtn = new CupertinoButton(
|
||||
child: new Text("launch action sheet"),
|
||||
onPressed: () =>
|
||||
{
|
||||
CupertinoRouteUtils.showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (context1) =>
|
||||
{
|
||||
return new CupertinoActionSheet(
|
||||
title: new Text("some choices"),
|
||||
actions: new List<Widget>(){
|
||||
new CupertinoActionSheetAction(
|
||||
child: new Text("one"),
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.pop(context1, 1);
|
||||
},
|
||||
isDefaultAction: true
|
||||
),
|
||||
new CupertinoActionSheetAction(
|
||||
child: new Text("two"),
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.pop(context1, 2);
|
||||
}
|
||||
),
|
||||
new CupertinoActionSheetAction(
|
||||
child: new Text("three"),
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.pop(context1, 3);
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
rowWidgtes.Add(cupBtn);
|
||||
|
||||
return new CupertinoPageScaffold(
|
||||
child: new Center(
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children:rowWidgtes
|
||||
)
|
||||
)
|
||||
/*,
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
middle: new Text("hello world")
|
||||
)*/
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CupertinoTextFieldDemo : StatefulWidget {
|
||||
public const string routeName = "/cupertino/text_fields";
|
||||
|
||||
public override State createState() {
|
||||
return new _CupertinoTextFieldDemoState();
|
||||
}
|
||||
}
|
||||
|
||||
class _CupertinoTextFieldDemoState : State<CupertinoTextFieldDemo> {
|
||||
TextEditingController _chatTextController;
|
||||
TextEditingController _locationTextController;
|
||||
|
||||
public override void initState() {
|
||||
base.initState();
|
||||
this._chatTextController = new TextEditingController();
|
||||
this._locationTextController = new TextEditingController(text: "Montreal, Canada");
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildChatTextField() {
|
||||
return new CupertinoTextField(
|
||||
controller: this._chatTextController,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
placeholder: "Text Message",
|
||||
decoration: new BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 0.0f,
|
||||
color: CupertinoColors.inactiveGray
|
||||
),
|
||||
borderRadius: BorderRadius.circular(15.0f)
|
||||
),
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.multiline,
|
||||
prefix: new Padding(padding: EdgeInsets.symmetric(horizontal: 4.0f)),
|
||||
suffix:
|
||||
new Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.0f),
|
||||
child: new CupertinoButton(
|
||||
color: CupertinoColors.activeGreen,
|
||||
minSize: 0.0f,
|
||||
child: new Icon(
|
||||
CupertinoIcons.up_arrow,
|
||||
size: 21.0f,
|
||||
color: CupertinoColors.white
|
||||
),
|
||||
padding: EdgeInsets.all(2.0f),
|
||||
borderRadius:
|
||||
BorderRadius.circular(15.0f),
|
||||
onPressed: () => this.setState(() => this._chatTextController.clear())
|
||||
|
||||
|
||||
class HomeScreen : StatelessWidget
|
||||
{
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
return new CupertinoPageScaffold(
|
||||
child: new Center(
|
||||
child: new CupertinoButton(
|
||||
child: new Text(
|
||||
"THIS IS TAB #"
|
||||
),
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.of(context).push(
|
||||
new CupertinoPageRoute(builder: (contex3) =>
|
||||
{
|
||||
return
|
||||
new CupertinoTextFieldDemo();
|
||||
})
|
||||
);
|
||||
}
|
||||
)
|
||||
//new Text("hello world!", style: CupertinoTheme.of(context).textTheme.navTitleTextStyle)
|
||||
)
|
||||
),
|
||||
autofocus: true,
|
||||
suffixMode: OverlayVisibilityMode.editing,
|
||||
onSubmitted: (string text) => this.setState(() => this._chatTextController.clear())
|
||||
);
|
||||
}
|
||||
//backgroundColor: Colors.brown
|
||||
);
|
||||
|
||||
Widget _buildNameField() {
|
||||
return new CupertinoTextField(
|
||||
prefix: new Icon(
|
||||
CupertinoIcons.person_solid,
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
size: 28.0f
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
|
||||
clearButtonMode: OverlayVisibilityMode.editing,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
autocorrect: false,
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
|
||||
),
|
||||
placeholder: "Name"
|
||||
);
|
||||
}
|
||||
List<BottomNavigationBarItem> items = new List<BottomNavigationBarItem>();
|
||||
items.Add(new BottomNavigationBarItem(
|
||||
icon: new Icon(CupertinoIcons.bell),
|
||||
title: new Text("views")
|
||||
));
|
||||
items.Add(new BottomNavigationBarItem(
|
||||
icon: new Icon(CupertinoIcons.eye_solid),
|
||||
title: new Text("articles")
|
||||
));
|
||||
return new CupertinoTabScaffold(
|
||||
tabBar: new CupertinoTabBar(
|
||||
items: items
|
||||
),
|
||||
tabBuilder: ((contex, index) =>
|
||||
{
|
||||
//return new Center(child: new Text("hello"));
|
||||
return new CupertinoTabView(
|
||||
builder: (contex1) =>
|
||||
{
|
||||
return new CupertinoPageScaffold(
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
middle: (index == 0) ? new Text("views") : new Text("articles")
|
||||
),
|
||||
child: new Center(
|
||||
/*child: new Text(
|
||||
"THIS IS TAB #" + index,
|
||||
style: CupertinoTheme.of(contex1)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
//.copyWith(fontSize:32)
|
||||
)*/
|
||||
child: new CupertinoButton(
|
||||
child: new Text(
|
||||
"THIS IS TAB #",
|
||||
style: CupertinoTheme.of(contex1)
|
||||
.textTheme
|
||||
.navTitleTextStyle
|
||||
//.copyWith(fontSize:32)
|
||||
),
|
||||
|
||||
Widget _buildEmailField() {
|
||||
return new CupertinoTextField(
|
||||
prefix: new Icon(
|
||||
CupertinoIcons.mail_solid,
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
size: 28.0f
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
|
||||
clearButtonMode: OverlayVisibilityMode.editing,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
autocorrect: false,
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
|
||||
),
|
||||
placeholder: "Email"
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLocationField() {
|
||||
return new CupertinoTextField(
|
||||
controller: this._locationTextController,
|
||||
prefix: new Icon(
|
||||
CupertinoIcons.location_solid,
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
size: 28.0f
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
|
||||
clearButtonMode: OverlayVisibilityMode.editing,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
|
||||
),
|
||||
placeholder: "Location"
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPinField() {
|
||||
return new CupertinoTextField(
|
||||
prefix: new Icon(
|
||||
CupertinoIcons.padlock_solid,
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
size: 28.0f
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
|
||||
clearButtonMode: OverlayVisibilityMode.editing,
|
||||
keyboardType: TextInputType.number,
|
||||
autocorrect: false,
|
||||
obscureText: true,
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
|
||||
),
|
||||
placeholder: "Create a PIN"
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTagsField() {
|
||||
return new CupertinoTextField(
|
||||
controller: new TextEditingController(text: "colleague, reading club"),
|
||||
prefix: new Icon(
|
||||
CupertinoIcons.tags_solid,
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
size: 28.0f
|
||||
),
|
||||
enabled: false,
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
return new DefaultTextStyle(
|
||||
style: new TextStyle(
|
||||
fontFamily: ".SF Pro Text", // ".SF UI Text",
|
||||
inherit: false,
|
||||
fontSize: 17.0f,
|
||||
color: CupertinoColors.black
|
||||
),
|
||||
child: new CupertinoPageScaffold(
|
||||
|
||||
child: new SafeArea(
|
||||
child: new ListView(
|
||||
children: new List<Widget>
|
||||
{
|
||||
/*new Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0f, horizontal: 16.0f),
|
||||
child: new Column(
|
||||
children: new List<Widget> {
|
||||
this._buildNameField(),
|
||||
this._buildEmailField(),
|
||||
this._buildLocationField(),
|
||||
this._buildPinField(),
|
||||
this._buildTagsField(),
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.of(contex1).push(
|
||||
new CupertinoPageRoute(builder: (contex3) =>
|
||||
{
|
||||
return
|
||||
new DetailScreen1(index == 0 ? "views" : "articles");
|
||||
})
|
||||
);
|
||||
}
|
||||
)
|
||||
),*/
|
||||
new Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0f, horizontal: 16.0f)//,
|
||||
//child: this._buildChatTextField()
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
})
|
||||
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class DetailScreen1 : StatelessWidget
|
||||
{
|
||||
public DetailScreen1(string topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
|
||||
}
|
||||
|
||||
public string topic;
|
||||
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
return new CupertinoPageScaffold(
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
//middle: new Text("Details")
|
||||
),
|
||||
child: new Center(
|
||||
child: new Text("hello world")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public class DetailScreen : StatefulWidget
|
||||
{
|
||||
public DetailScreen(string topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
public string topic;
|
||||
|
||||
|
||||
public override State createState()
|
||||
{
|
||||
return new DetailScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
public class DetailScreenState : State<DetailScreen>
|
||||
{
|
||||
public bool switchValue = false;
|
||||
|
||||
public override Widget build(BuildContext context)
|
||||
{
|
||||
var widgets = new List<Widget>();
|
||||
widgets.Add(new Expanded(child: new Text("a switch")));
|
||||
widgets.Add(new CupertinoSwitch(
|
||||
value: switchValue,
|
||||
onChanged: value => { setState(() => switchValue = value); }
|
||||
));
|
||||
var rowWidgtes = new List<Widget>();
|
||||
var row = new Row(children: widgets);
|
||||
//rowWidgtes.Add(row);
|
||||
|
||||
var cupBtn = new CupertinoButton(
|
||||
child: new Text("launch action sheet"),
|
||||
onPressed: () =>
|
||||
{
|
||||
CupertinoRouteUtils.showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (context1) =>
|
||||
{
|
||||
return new CupertinoActionSheet(
|
||||
title: new Text("some choices"),
|
||||
actions: new List<Widget>()
|
||||
{
|
||||
new CupertinoActionSheetAction(
|
||||
child: new Text("one"),
|
||||
onPressed: () => { Navigator.pop(context1, 1); },
|
||||
isDefaultAction: true
|
||||
),
|
||||
new CupertinoActionSheetAction(
|
||||
child: new Text("two"),
|
||||
onPressed: () => { Navigator.pop(context1, 2); }
|
||||
),
|
||||
new CupertinoActionSheetAction(
|
||||
child: new Text("three"),
|
||||
onPressed: () => { Navigator.pop(context1, 3); }
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
rowWidgtes.Add(cupBtn);
|
||||
|
||||
return new CupertinoPageScaffold(
|
||||
child: new Center(
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: rowWidgtes
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
/*,
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
middle: new Text("hello world")
|
||||
)*/
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
using UIWidgetsGallery.gallery;
|
||||
using Unity.UIWidgets.engine;
|
||||
using Unity.UIWidgets.engine2;
|
||||
using Unity.UIWidgets.material;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UIWidgetsGallery {
|
||||
/*public class GalleryMain : UIWidgetsPanel {
|
||||
protected override Widget createWidget() {
|
||||
public class GalleryMain : UIWidgetsPanel {
|
||||
/*protected override Widget createWidget() {
|
||||
return new GalleryApp();
|
||||
}
|
||||
}*/
|
||||
|
||||
protected override void OnEnable() {
|
||||
/*protected override void OnEnable() {
|
||||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons");
|
||||
FontManager.instance.addFont(Resources.Load<Font>("fonts/GalleryIcons"), "GalleryIcons");
|
||||
|
||||
|
@ -21,6 +21,6 @@ namespace UIWidgetsGallery {
|
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Bold"), ".SF Pro Text", FontWeight.w700);
|
||||
|
||||
base.OnEnable();
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,8 @@ namespace UIWidgetsGallery.gallery {
|
|||
padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
|
||||
)
|
||||
),
|
||||
placeholder:"test"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -159,29 +160,37 @@ namespace UIWidgetsGallery.gallery {
|
|||
color: CupertinoColors.black
|
||||
),
|
||||
child: new CupertinoPageScaffold(
|
||||
navigationBar: new CupertinoNavigationBar(
|
||||
/*navigationBar: new CupertinoNavigationBar(
|
||||
previousPageTitle: "Cupertino",
|
||||
middle: new Text("Text Fields")
|
||||
),
|
||||
child: new SafeArea(
|
||||
child: new ListView(
|
||||
),*/
|
||||
child:
|
||||
/*new Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0f, horizontal: 16.0f),
|
||||
child: this._buildTagsField()//_buildChatTextField()
|
||||
)*/
|
||||
new SafeArea(
|
||||
child:
|
||||
|
||||
|
||||
new ListView(
|
||||
children: new List<Widget> {
|
||||
new Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0f, horizontal: 16.0f),
|
||||
child: new Column(
|
||||
children: new List<Widget> {
|
||||
this._buildNameField(),
|
||||
this._buildEmailField(),
|
||||
this._buildLocationField(),
|
||||
this._buildPinField(),
|
||||
this._buildTagsField(),
|
||||
//this._buildNameField(),
|
||||
//this._buildEmailField(),// !点击crash!
|
||||
this._buildLocationField()//, // !点击crash!
|
||||
//this._buildPinField(),// !点击crash!
|
||||
//this._buildTagsField()
|
||||
}
|
||||
)
|
||||
),
|
||||
new Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0f, horizontal: 16.0f),
|
||||
child: this._buildChatTextField()
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0f, horizontal: 16.0f)//,
|
||||
//child: this._buildChatTextField()
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.gestures;
|
||||
|
@ -10,35 +11,37 @@ using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
|||
namespace Unity.UIWidgets.cupertino {
|
||||
class CupertinoActionSheetUtils {
|
||||
public static readonly TextStyle _kActionSheetActionStyle = new TextStyle(
|
||||
// fontFamily: ".SF UI Text",
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontFamily: ".SF UI Text",
|
||||
inherit: false,
|
||||
fontSize: 20.0f,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: CupertinoColors.activeBlue,
|
||||
textBaseline: TextBaseline.alphabetic
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kActionSheetContentStyle = new TextStyle(
|
||||
// fontFamily: ".SF UI Text",
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontFamily: ".SF UI Text",
|
||||
inherit: false,
|
||||
fontSize: 13.0f,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: _kContentTextColor,
|
||||
textBaseline: TextBaseline.alphabetic
|
||||
);
|
||||
|
||||
public static readonly BoxDecoration _kAlertBlurOverlayDecoration = new BoxDecoration(
|
||||
color: CupertinoColors.white,
|
||||
backgroundBlendMode: BlendMode.overlay
|
||||
public static readonly Color _kBackgroundColor = CupertinoDynamicColor.withBrightness(
|
||||
color: new Color(0xC7F9F9F9),
|
||||
darkColor: new Color(0xC7252525)
|
||||
);
|
||||
public static readonly Color _kPressedColor = CupertinoDynamicColor.withBrightness(
|
||||
color: new Color(0xFFE1E1E1),
|
||||
darkColor: new Color(0xFF2E2E2E)
|
||||
);
|
||||
|
||||
public static readonly Color _kBackgroundColor = new Color(0xD1F8F8F8);
|
||||
public static readonly Color _kPressedColor = new Color(0xA6E5E5EA);
|
||||
public static readonly Color _kButtonDividerColor = new Color(0x403F3F3F);
|
||||
public static readonly Color _kCancelPressedColor = CupertinoDynamicColor.withBrightness(
|
||||
color: new Color(0xFFECECEC),
|
||||
darkColor: new Color(0xFF49494B)
|
||||
);
|
||||
|
||||
public static readonly Color _kContentTextColor = new Color(0xFF8F8F8F);
|
||||
public static readonly Color _kCancelButtonPressedColor = new Color(0xFFEAEAEA);
|
||||
public static readonly Color _kButtonDividerColor = _kContentTextColor;
|
||||
|
||||
public const float _kBlurAmount = 20.0f;
|
||||
public const float _kEdgeHorizontalPadding = 8.0f;
|
||||
|
@ -79,7 +82,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public readonly ScrollController actionScrollController;
|
||||
public readonly Widget cancelButton;
|
||||
|
||||
Widget _buildContent() {
|
||||
Widget _buildContent( BuildContext context ) {
|
||||
List<Widget> content = new List<Widget>();
|
||||
if (title != null || message != null) {
|
||||
Widget titleSection = new _CupertinoAlertContentSection(
|
||||
|
@ -91,7 +94,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
return new Container(
|
||||
color: CupertinoActionSheetUtils._kBackgroundColor,
|
||||
color: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kBackgroundColor, context),//CupertinoActionSheetUtils._kBackgroundColor,
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
@ -131,15 +134,20 @@ namespace Unity.UIWidgets.cupertino {
|
|||
new Flexible(child: new ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12.0f),
|
||||
child: new BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: CupertinoActionSheetUtils._kBlurAmount,
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: CupertinoActionSheetUtils._kBlurAmount,
|
||||
sigmaY: CupertinoActionSheetUtils._kBlurAmount),
|
||||
child: new Container(
|
||||
child: new _CupertinoAlertRenderWidget(
|
||||
contentSection: new Builder(builder: _buildContent),
|
||||
actionsSection: _buildActions()
|
||||
)
|
||||
/*new Container(
|
||||
decoration: CupertinoActionSheetUtils._kAlertBlurOverlayDecoration,
|
||||
child: new _CupertinoAlertRenderWidget(
|
||||
contentSection: _buildContent(),
|
||||
actionsSection: _buildActions()
|
||||
)
|
||||
)
|
||||
)*/
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@ -161,7 +169,30 @@ namespace Unity.UIWidgets.cupertino {
|
|||
actionSheetWidth = MediaQuery.of(context).size.height -
|
||||
(CupertinoActionSheetUtils._kEdgeHorizontalPadding * 2);
|
||||
}
|
||||
|
||||
/// tbc semantics
|
||||
/*return new SafeArea(
|
||||
child: new Semantics(
|
||||
namesRoute: true,
|
||||
scopesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
label: "Alert",
|
||||
child: new CupertinoUserInterfaceLevel(
|
||||
data: CupertinoUserInterfaceLevelData.elevated,
|
||||
child: new Container(
|
||||
width: actionSheetWidth,
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: CupertinoActionSheetUtils._kEdgeHorizontalPadding,
|
||||
vertical: CupertinoActionSheetUtils._kEdgeVerticalPadding
|
||||
),
|
||||
child: new Column(
|
||||
children: children,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);*/
|
||||
return new SafeArea(
|
||||
child: new Container(
|
||||
width: actionSheetWidth,
|
||||
|
@ -182,11 +213,13 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public class CupertinoActionSheetAction : StatelessWidget {
|
||||
public CupertinoActionSheetAction(
|
||||
Widget child,
|
||||
VoidCallback onPressed,
|
||||
Key key = null,
|
||||
VoidCallback onPressed = null,
|
||||
bool isDefaultAction = false,
|
||||
bool isDestructiveAction = false
|
||||
) {
|
||||
bool isDestructiveAction = false,
|
||||
Widget child = null
|
||||
):base(key:key)
|
||||
{
|
||||
D.assert(child != null);
|
||||
D.assert(onPressed != null);
|
||||
this.child = child;
|
||||
|
@ -201,16 +234,16 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public readonly Widget child;
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
TextStyle style = CupertinoActionSheetUtils._kActionSheetActionStyle;
|
||||
TextStyle style =CupertinoActionSheetUtils. _kActionSheetActionStyle.copyWith(
|
||||
color: isDestructiveAction
|
||||
? CupertinoDynamicColor.resolve(CupertinoColors.systemRed, context)
|
||||
: CupertinoTheme.of(context).primaryColor);
|
||||
//CupertinoActionSheetUtils._kActionSheetActionStyle;
|
||||
|
||||
if (isDefaultAction) {
|
||||
style = style.copyWith(fontWeight: FontWeight.w600);
|
||||
}
|
||||
|
||||
if (isDestructiveAction) {
|
||||
style = style.copyWith(color: CupertinoColors.destructiveRed);
|
||||
}
|
||||
|
||||
return new GestureDetector(
|
||||
onTap: () => onPressed(),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
|
@ -218,6 +251,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
constraints: new BoxConstraints(
|
||||
minHeight: CupertinoActionSheetUtils._kButtonHeight
|
||||
),
|
||||
////tbc semantics
|
||||
child: new Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(
|
||||
|
@ -251,33 +285,30 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
class _CupertinoActionSheetCancelButtonState : State<_CupertinoActionSheetCancelButton> {
|
||||
Color _backgroundColor;
|
||||
|
||||
public override void initState() {
|
||||
_backgroundColor = CupertinoColors.white;
|
||||
base.initState();
|
||||
}
|
||||
|
||||
bool isBeingPressed = false;
|
||||
void _onTapDown(TapDownDetails evt) {
|
||||
setState(() => { _backgroundColor = CupertinoActionSheetUtils._kCancelButtonPressedColor; });
|
||||
setState(() => { isBeingPressed = true; });
|
||||
}
|
||||
|
||||
void _onTapUp(TapUpDetails evt) {
|
||||
setState(() => { _backgroundColor = CupertinoColors.white; });
|
||||
setState(() => { isBeingPressed = false; });
|
||||
}
|
||||
|
||||
void _onTapCancel() {
|
||||
setState(() => { _backgroundColor = CupertinoColors.white; });
|
||||
setState(() => { isBeingPressed = false; });
|
||||
}
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
Color backgroundColor = isBeingPressed
|
||||
? CupertinoActionSheetUtils._kCancelPressedColor
|
||||
: CupertinoColors.secondarySystemGroupedBackground;
|
||||
return new GestureDetector(
|
||||
onTapDown: _onTapDown,
|
||||
onTapUp: _onTapUp,
|
||||
onTapCancel: _onTapCancel,
|
||||
child: new Container(
|
||||
decoration: new BoxDecoration(
|
||||
color: _backgroundColor,
|
||||
color: CupertinoDynamicColor.resolve(backgroundColor, context),
|
||||
borderRadius: BorderRadius.circular(CupertinoActionSheetUtils._kCornerRadius)
|
||||
),
|
||||
child: widget.child
|
||||
|
@ -288,9 +319,10 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
class _CupertinoAlertRenderWidget : RenderObjectWidget {
|
||||
public _CupertinoAlertRenderWidget(
|
||||
Widget contentSection,
|
||||
Widget actionsSection,
|
||||
Key key = null
|
||||
Key key = null,
|
||||
Widget contentSection = null,
|
||||
Widget actionsSection = null
|
||||
|
||||
) : base(key: key) {
|
||||
this.contentSection = contentSection;
|
||||
this.actionsSection = actionsSection;
|
||||
|
@ -302,13 +334,20 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public override RenderObject createRenderObject(BuildContext context) {
|
||||
return new _RenderCupertinoAlert(
|
||||
dividerThickness: CupertinoActionSheetUtils._kDividerThickness /
|
||||
MediaQuery.of(context).devicePixelRatio
|
||||
MediaQuery.of(context).devicePixelRatio,
|
||||
dividerColor: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kButtonDividerColor, context)
|
||||
);
|
||||
}
|
||||
|
||||
public override void updateRenderObject(BuildContext context, _RenderCupertinoAlert renderObject) {
|
||||
base.updateRenderObject(context, renderObject);
|
||||
renderObject.dividerColor = CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kButtonDividerColor, context);
|
||||
}
|
||||
|
||||
public override Element createElement() {
|
||||
return new _CupertinoAlertRenderElement(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class _CupertinoAlertRenderElement : RenderObjectElement {
|
||||
|
@ -318,11 +357,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
Element _contentElement;
|
||||
Element _actionsElement;
|
||||
|
||||
public new _CupertinoAlertRenderWidget widget {
|
||||
public override _CupertinoAlertRenderWidget widget {
|
||||
get { return base.widget as _CupertinoAlertRenderWidget; }
|
||||
}
|
||||
|
||||
public new _RenderCupertinoAlert renderObject {
|
||||
public override _RenderCupertinoAlert renderObject {
|
||||
get { return base.renderObject as _RenderCupertinoAlert; }
|
||||
}
|
||||
|
||||
|
@ -360,7 +399,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
_AlertSections.actionsSection);
|
||||
}
|
||||
|
||||
protected override void forgetChild(Element child) {
|
||||
public override void forgetChild(Element child) {
|
||||
D.assert(child == _contentElement || child == _actionsElement);
|
||||
if (_contentElement == child) {
|
||||
_contentElement = null;
|
||||
|
@ -368,6 +407,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
else if (_actionsElement == child) {
|
||||
_actionsElement = null;
|
||||
}
|
||||
base.forgetChild(child);
|
||||
}
|
||||
|
||||
protected override void removeChildRenderObject(RenderObject child) {
|
||||
|
@ -381,6 +421,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
void _placeChildInSlot(RenderObject child, object slot) {
|
||||
D.assert(slot != null);
|
||||
switch ((_AlertSections) slot) {
|
||||
case _AlertSections.contentSection:
|
||||
renderObject.contentSection = child as RenderBox;
|
||||
|
@ -398,11 +439,16 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public _RenderCupertinoAlert(
|
||||
RenderBox contentSection = null,
|
||||
RenderBox actionsSection = null,
|
||||
float dividerThickness = 0.0f
|
||||
float dividerThickness = 0.0f,
|
||||
Color dividerColor = null
|
||||
) {
|
||||
D.assert(dividerColor != null);
|
||||
_contentSection = contentSection;
|
||||
_actionsSection = actionsSection;
|
||||
_dividerThickness = dividerThickness;
|
||||
_dividerPaint = new Paint();
|
||||
_dividerPaint.color = CupertinoActionSheetUtils._kButtonDividerColor;
|
||||
_dividerPaint.style = PaintingStyle.fill;
|
||||
}
|
||||
|
||||
public RenderBox contentSection {
|
||||
|
@ -422,8 +468,6 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
RenderBox _contentSection;
|
||||
|
||||
|
||||
public RenderBox actionsSection {
|
||||
get { return _actionsSection; }
|
||||
set {
|
||||
|
@ -442,12 +486,19 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
RenderBox _actionsSection;
|
||||
|
||||
readonly float _dividerThickness;
|
||||
public Color dividerColor {
|
||||
get { return _dividerPaint.color; }
|
||||
set {
|
||||
if (value == _dividerPaint.color) {
|
||||
return;
|
||||
}
|
||||
_dividerPaint.color = value;
|
||||
markNeedsPaint();
|
||||
}
|
||||
}
|
||||
|
||||
readonly Paint _dividerPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kButtonDividerColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
public readonly float _dividerThickness;
|
||||
public readonly Paint _dividerPaint;
|
||||
|
||||
public override void attach(object owner) {
|
||||
base.attach(owner);
|
||||
|
@ -535,7 +586,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
protected internal override float computeMaxIntrinsicHeight(float width) {
|
||||
protected override float computeMaxIntrinsicHeight(float width) {
|
||||
float contentHeight = contentSection.getMaxIntrinsicHeight(width);
|
||||
float actionsHeight = actionsSection.getMaxIntrinsicHeight(width);
|
||||
bool hasDivider = contentHeight > 0.0f && actionsHeight > 0.0f;
|
||||
|
@ -552,7 +603,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
protected override void performLayout() {
|
||||
public override void performLayout() {
|
||||
bool hasDivider = contentSection.getMaxIntrinsicHeight(constraints.maxWidth) > 0.0f
|
||||
&& actionsSection.getMaxIntrinsicHeight(constraints.maxWidth) > 0.0f;
|
||||
float dividerThickness = hasDivider ? _dividerThickness : 0.0f;
|
||||
|
@ -573,7 +624,6 @@ namespace Unity.UIWidgets.cupertino {
|
|||
);
|
||||
Size actionsSize = actionsSection.size;
|
||||
|
||||
|
||||
float actionSheetHeight = contentSize.height + dividerThickness + actionsSize.height;
|
||||
|
||||
|
||||
|
@ -598,16 +648,18 @@ namespace Unity.UIWidgets.cupertino {
|
|||
actionsSection.paint(context, offset + actionsParentData.offset);
|
||||
}
|
||||
|
||||
void _paintDividerBetweenContentAndActions(Canvas canvas, Offset offset) {
|
||||
public void _paintDividerBetweenContentAndActions(Canvas canvas, Offset offset) {
|
||||
canvas.drawRect(
|
||||
Rect.fromLTWH(
|
||||
offset.dx,
|
||||
offset.dy + contentSection.size.height, size.width, _dividerThickness
|
||||
offset.dy + contentSection.size.height,
|
||||
size.width,
|
||||
_dividerThickness
|
||||
), _dividerPaint
|
||||
);
|
||||
}
|
||||
|
||||
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
|
||||
public override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
|
||||
MultiChildLayoutParentData contentSectionParentData =
|
||||
contentSection.parentData as MultiChildLayoutParentData;
|
||||
MultiChildLayoutParentData actionsSectionParentData =
|
||||
|
@ -725,8 +777,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
class _CupertinoAlertActionSection : StatefulWidget {
|
||||
public _CupertinoAlertActionSection(
|
||||
List<Widget> children,
|
||||
Key key = null,
|
||||
List<Widget> children = null,
|
||||
ScrollController scrollController = null,
|
||||
bool hasCancelButton = false
|
||||
) : base(key: key) {
|
||||
|
@ -788,7 +840,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
bool _isPressed = false;
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
return new _ActionSheetActionButtonParentDataWidget(
|
||||
return new _ActionButtonParentDataWidget(
|
||||
isPressed: _isPressed,
|
||||
child: new GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
|
@ -801,8 +853,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
class _ActionSheetActionButtonParentDataWidget : ParentDataWidget<_CupertinoAlertActionsRenderWidget> {
|
||||
public _ActionSheetActionButtonParentDataWidget(
|
||||
class _ActionButtonParentDataWidget : ParentDataWidget<_ActionButtonParentData> {
|
||||
public _ActionButtonParentDataWidget(
|
||||
Widget child,
|
||||
bool isPressed = false,
|
||||
Key key = null
|
||||
|
@ -813,21 +865,29 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public readonly bool isPressed;
|
||||
|
||||
public override void applyParentData(RenderObject renderObject) {
|
||||
D.assert(renderObject.parentData is _ActionSheetActionButtonParentData);
|
||||
_ActionSheetActionButtonParentData parentData =
|
||||
renderObject.parentData as _ActionSheetActionButtonParentData;
|
||||
D.assert(renderObject.parentData is _ActionButtonParentData);
|
||||
_ActionButtonParentData parentData =
|
||||
renderObject.parentData as _ActionButtonParentData;
|
||||
if (parentData.isPressed != isPressed) {
|
||||
parentData.isPressed = isPressed;
|
||||
AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent;
|
||||
// AbstractNode targetParent = renderObject.parent;
|
||||
// tbc
|
||||
if (targetParent is RenderObject) {
|
||||
((RenderObject) targetParent).markNeedsPaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new Type debugTypicalAncestorWidgetClass {
|
||||
get {
|
||||
return typeof(_CupertinoAlertActionsRenderWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _ActionSheetActionButtonParentData : MultiChildLayoutParentData {
|
||||
public _ActionSheetActionButtonParentData(
|
||||
public class _ActionButtonParentData : MultiChildLayoutParentData {
|
||||
public _ActionButtonParentData(
|
||||
bool isPressed = false
|
||||
) {
|
||||
this.isPressed = isPressed;
|
||||
|
@ -835,11 +895,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public bool isPressed;
|
||||
}
|
||||
|
||||
|
||||
class _CupertinoAlertActionsRenderWidget : MultiChildRenderObjectWidget {
|
||||
public _CupertinoAlertActionsRenderWidget(
|
||||
List<Widget> actionButtons,
|
||||
Key key = null,
|
||||
List<Widget> actionButtons = null,
|
||||
float dividerThickness = 0.0f,
|
||||
bool hasCancelButton = false
|
||||
) : base(key: key, children: actionButtons) {
|
||||
|
@ -853,13 +913,21 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public override RenderObject createRenderObject(BuildContext context) {
|
||||
return new _RenderCupertinoAlertActions(
|
||||
dividerThickness: _dividerThickness,
|
||||
hasCancelButton: _hasCancelButton
|
||||
dividerColor: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kButtonDividerColor, context),
|
||||
hasCancelButton: _hasCancelButton,
|
||||
backgroundColor: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kBackgroundColor, context),
|
||||
pressedColor: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kPressedColor, context)
|
||||
);
|
||||
}
|
||||
|
||||
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
|
||||
((_RenderCupertinoAlertActions) renderObject).dividerThickness = _dividerThickness;
|
||||
((_RenderCupertinoAlertActions) renderObject).dividerColor =
|
||||
CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kButtonDividerColor, context);
|
||||
((_RenderCupertinoAlertActions) renderObject).hasCancelButton = _hasCancelButton;
|
||||
((_RenderCupertinoAlertActions) renderObject).backgroundColor =
|
||||
CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kBackgroundColor, context);
|
||||
((_RenderCupertinoAlertActions) renderObject).pressedColor = CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kPressedColor, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -868,13 +936,32 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public _RenderCupertinoAlertActions(
|
||||
List<RenderBox> children = null,
|
||||
float dividerThickness = 0.0f,
|
||||
bool hasCancelButton = false
|
||||
Color dividerColor = null,
|
||||
bool hasCancelButton = false,
|
||||
Color backgroundColor = null,
|
||||
Color pressedColor = null
|
||||
) {
|
||||
_dividerThickness = dividerThickness;
|
||||
_hasCancelButton = hasCancelButton;
|
||||
addAll(children ?? new List<RenderBox>());
|
||||
|
||||
_buttonBackgroundPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kBackgroundColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
|
||||
_pressedButtonBackgroundPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kPressedColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
|
||||
_dividerPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kButtonDividerColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
addAll(children);
|
||||
}
|
||||
|
||||
float _dividerThickness;
|
||||
public float dividerThickness {
|
||||
get { return _dividerThickness; }
|
||||
set {
|
||||
|
@ -887,10 +974,40 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
float _dividerThickness;
|
||||
public Color backgroundColor {
|
||||
get { return _buttonBackgroundPaint.color; }
|
||||
set {
|
||||
if (value == _buttonBackgroundPaint.color) {
|
||||
return;
|
||||
}
|
||||
_buttonBackgroundPaint.color = value;
|
||||
markNeedsPaint();
|
||||
}
|
||||
}
|
||||
|
||||
public Color dividerColor {
|
||||
get { return _dividerPaint.color; }
|
||||
set {
|
||||
if (value == _dividerPaint.color) {
|
||||
return;
|
||||
}
|
||||
_dividerPaint.color = value;
|
||||
markNeedsPaint();
|
||||
}
|
||||
}
|
||||
|
||||
public Color pressedColor {
|
||||
get { return _pressedButtonBackgroundPaint.color; }
|
||||
set {
|
||||
if (value == _pressedButtonBackgroundPaint.color) {
|
||||
return;
|
||||
}
|
||||
_pressedButtonBackgroundPaint.color = value;
|
||||
markNeedsPaint();
|
||||
}
|
||||
}
|
||||
|
||||
bool _hasCancelButton;
|
||||
|
||||
public bool hasCancelButton {
|
||||
get { return _hasCancelButton; }
|
||||
set {
|
||||
|
@ -903,25 +1020,13 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
readonly Paint _buttonBackgroundPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kBackgroundColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
|
||||
readonly Paint _pressedButtonBackgroundPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kPressedColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
|
||||
readonly Paint _dividerPaint = new Paint() {
|
||||
color = CupertinoActionSheetUtils._kButtonDividerColor,
|
||||
style = PaintingStyle.fill
|
||||
};
|
||||
public readonly Paint _buttonBackgroundPaint;
|
||||
public readonly Paint _pressedButtonBackgroundPaint;
|
||||
public readonly Paint _dividerPaint;
|
||||
|
||||
public override void setupParentData(RenderObject child) {
|
||||
if (!(child.parentData is _ActionSheetActionButtonParentData)) {
|
||||
child.parentData = new _ActionSheetActionButtonParentData();
|
||||
if (!(child.parentData is _ActionButtonParentData)) {
|
||||
child.parentData = new _ActionButtonParentData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -970,7 +1075,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
+ (0.5f * childAfter(firstChild).getMinIntrinsicHeight(width));
|
||||
}
|
||||
|
||||
protected internal override float computeMaxIntrinsicHeight(float width) {
|
||||
protected override float computeMaxIntrinsicHeight(float width) {
|
||||
if (childCount == 0) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
@ -1034,7 +1139,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
void _drawButtonBackgroundsAndDividersStacked(Canvas canvas, Offset offset) {
|
||||
Offset dividerOffset = new Offset(0.0f, dividerThickness);
|
||||
Path backgroundFillPath = new Path();
|
||||
// fillType = PathFillType.evenOdd
|
||||
backgroundFillPath.fillType = PathFillType.evenOdd;
|
||||
backgroundFillPath.addRect(Rect.fromLTWH(0.0f, 0.0f, size.width, size.height));
|
||||
|
||||
Path pressedBackgroundFillPath = new Path();
|
||||
|
@ -1042,16 +1147,19 @@ namespace Unity.UIWidgets.cupertino {
|
|||
Offset accumulatingOffset = offset;
|
||||
RenderBox child = firstChild;
|
||||
RenderBox prevChild = null;
|
||||
|
||||
while (child != null) {
|
||||
D.assert(child.parentData is _ActionSheetActionButtonParentData);
|
||||
_ActionSheetActionButtonParentData currentButtonParentData =
|
||||
child.parentData as _ActionSheetActionButtonParentData;
|
||||
D.assert(child.parentData is _ActionButtonParentData);
|
||||
_ActionButtonParentData currentButtonParentData =
|
||||
child.parentData as _ActionButtonParentData;
|
||||
bool isButtonPressed = currentButtonParentData.isPressed;
|
||||
|
||||
bool isPrevButtonPressed = false;
|
||||
|
||||
if (prevChild != null) {
|
||||
D.assert(prevChild.parentData is _ActionSheetActionButtonParentData);
|
||||
_ActionSheetActionButtonParentData previousButtonParentData =
|
||||
prevChild.parentData as _ActionSheetActionButtonParentData;
|
||||
D.assert(prevChild.parentData is _ActionButtonParentData);
|
||||
_ActionButtonParentData previousButtonParentData =
|
||||
prevChild.parentData as _ActionButtonParentData;
|
||||
isPrevButtonPressed = previousButtonParentData.isPressed;
|
||||
}
|
||||
|
||||
|
@ -1059,12 +1167,15 @@ namespace Unity.UIWidgets.cupertino {
|
|||
bool isDividerPainted = isDividerPresent && !(isButtonPressed || isPrevButtonPressed);
|
||||
Rect dividerRect = Rect.fromLTWH(
|
||||
accumulatingOffset.dx,
|
||||
accumulatingOffset.dy, size.width, _dividerThickness
|
||||
accumulatingOffset.dy,
|
||||
size.width,
|
||||
_dividerThickness
|
||||
);
|
||||
Rect buttonBackgroundRect = Rect.fromLTWH(
|
||||
accumulatingOffset.dx,
|
||||
accumulatingOffset.dy + (isDividerPresent ? dividerThickness : 0.0f), size.width,
|
||||
child.size.height
|
||||
accumulatingOffset.dy + (isDividerPresent ? dividerThickness : 0.0f),
|
||||
size.width,
|
||||
child.size.height
|
||||
);
|
||||
if (isButtonPressed) {
|
||||
backgroundFillPath.addRect(buttonBackgroundRect);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.UIWidgets.animation;
|
||||
using Unity.UIWidgets.cupertino;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
|
@ -10,11 +12,20 @@ using Color = Unity.UIWidgets.ui.Color;
|
|||
namespace Unity.UIWidgets.cupertino {
|
||||
static class CupertinoActivityIndicatorUtils {
|
||||
public const float _kDefaultIndicatorRadius = 10.0f;
|
||||
public const Color _kActiveTickColor = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFF3C3C44),
|
||||
darkColor: Color(0xFFEBEBF5)
|
||||
);
|
||||
|
||||
public const float _kTwoPI = Mathf.PI * 2.0f;
|
||||
public const int _kTickCount = 12;
|
||||
// list
|
||||
public static int[] _alphaValues = {
|
||||
147, 131, 114, 97, 81, 64, 47, 47, 47, 47, 47, 47
|
||||
};
|
||||
public const int _kHalfTickCount = _kTickCount / 2;
|
||||
public static readonly Color _kTickColor = CupertinoColors.lightBackgroundGray;
|
||||
public static readonly Color _kActiveTickColor = new Color(0xFF9D9D9D);
|
||||
|
||||
}
|
||||
|
||||
public class CupertinoActivityIndicator : StatefulWidget {
|
||||
|
@ -23,6 +34,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
bool animating = true,
|
||||
float radius = CupertinoActivityIndicatorUtils._kDefaultIndicatorRadius
|
||||
) : base(key: key) {
|
||||
D.assert(animating != null);
|
||||
D.assert(radius != null);
|
||||
D.assert(radius > 0);
|
||||
this.animating = animating;
|
||||
this.radius = radius;
|
||||
|
@ -77,6 +90,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
child: new CustomPaint(
|
||||
painter: new _CupertinoActivityIndicatorPainter(
|
||||
position: _controller,
|
||||
activeColor: CupertinoDynamicColor.resolve(CupertinoActivityIndicatorUtils._kActiveTickColor, context),
|
||||
radius: widget.radius
|
||||
)
|
||||
)
|
||||
|
@ -84,24 +98,29 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
class _CupertinoActivityIndicatorPainter : AbstractCustomPainter {
|
||||
class _CupertinoActivityIndicatorPainter : CustomPainter {
|
||||
//AbstractCustomPainter {
|
||||
public _CupertinoActivityIndicatorPainter(
|
||||
Animation<float> position,
|
||||
float radius
|
||||
Animation<float> position = null,
|
||||
Color activeColor = null,
|
||||
float radius =0f
|
||||
) : base(repaint: position) {
|
||||
|
||||
tickFundamentalRRect = RRect.fromLTRBXY(
|
||||
left: -radius,
|
||||
top: 1.0f * radius / CupertinoActivityIndicatorUtils._kDefaultIndicatorRadius,
|
||||
right: -radius / 2.0f,
|
||||
bottom: -1.0f * radius / CupertinoActivityIndicatorUtils._kDefaultIndicatorRadius,
|
||||
radiusX: 1.0f,
|
||||
radiusY: 1.0f
|
||||
radiusX: 1.0f * radius / CupertinoActivityIndicatorUtils._kDefaultIndicatorRadius,
|
||||
radiusY: 1.0f * radius / CupertinoActivityIndicatorUtils._kDefaultIndicatorRadius
|
||||
);
|
||||
this.position = position;
|
||||
this.activeColor = activeColor;
|
||||
}
|
||||
|
||||
readonly Animation<float> position;
|
||||
readonly RRect tickFundamentalRRect;
|
||||
|
||||
public readonly Animation<float> position;
|
||||
public readonly RRect tickFundamentalRRect;
|
||||
public readonly Color activeColor;
|
||||
|
||||
public override void paint(Canvas canvas, Size size) {
|
||||
Paint paint = new Paint();
|
||||
|
@ -112,10 +131,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
int activeTick = (CupertinoActivityIndicatorUtils._kTickCount * position.value).floor();
|
||||
|
||||
for (int i = 0; i < CupertinoActivityIndicatorUtils._kTickCount; ++i) {
|
||||
float t = (((i + activeTick) % CupertinoActivityIndicatorUtils._kTickCount) /
|
||||
CupertinoActivityIndicatorUtils._kHalfTickCount).clamp(0, 1);
|
||||
paint.color = Color.lerp(a: CupertinoActivityIndicatorUtils._kActiveTickColor,
|
||||
b: CupertinoActivityIndicatorUtils._kTickColor, t: t);
|
||||
int t = ((i + activeTick) % CupertinoActivityIndicatorUtils._kTickCount);
|
||||
paint.color = activeColor.withAlpha(CupertinoActivityIndicatorUtils._alphaValues[t]);
|
||||
canvas.drawRRect(tickFundamentalRRect,paint);
|
||||
canvas.rotate(-CupertinoActivityIndicatorUtils._kTwoPI / CupertinoActivityIndicatorUtils._kTickCount);
|
||||
}
|
||||
|
@ -124,7 +141,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
public override bool shouldRepaint(CustomPainter oldPainter) {
|
||||
return (oldPainter as _CupertinoActivityIndicatorPainter).position != position;
|
||||
return ((oldPainter as _CupertinoActivityIndicatorPainter).position != position) ||
|
||||
((oldPainter as _CupertinoActivityIndicatorPainter).activeColor != activeColor);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.material;
|
||||
//using Unity.UIWidgets.material;
|
||||
using Unity.UIWidgets.painting;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
|
@ -26,9 +26,23 @@ namespace Unity.UIWidgets.cupertino {
|
|||
LocaleListResolutionCallback localeListResolutionCallback = null,
|
||||
LocaleResolutionCallback localeResolutionCallback = null,
|
||||
List<Locale> supportedLocales = null,
|
||||
bool showPerformanceOverlay = false
|
||||
bool showPerformanceOverlay = false,
|
||||
bool checkerboardRasterCacheImages = false,
|
||||
bool checkerboardOffscreenLayers = false,
|
||||
bool showSemanticsDebugger = false,
|
||||
bool debugShowCheckedModeBanner = true
|
||||
// tbc????
|
||||
//Dictionary<LogicalKeySet, Intent> shortcuts = null,
|
||||
//Dictionary<LocalKey, ActionFactory> actions = null
|
||||
) : base(key: key) {
|
||||
D.assert(routes != null);
|
||||
D.assert(navigatorObservers != null);
|
||||
D.assert(title != null);
|
||||
D.assert(showPerformanceOverlay != null);
|
||||
D.assert(checkerboardRasterCacheImages != null);
|
||||
D.assert(checkerboardOffscreenLayers != null);
|
||||
D.assert(showSemanticsDebugger != null);
|
||||
D.assert(debugShowCheckedModeBanner != null);
|
||||
|
||||
supportedLocales = supportedLocales ?? new List<Locale> {new Locale("en", "US")};
|
||||
this.navigatorKey = navigatorKey;
|
||||
|
@ -57,6 +71,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public readonly Dictionary<string, WidgetBuilder> routes;
|
||||
public readonly string initialRoute;
|
||||
public readonly RouteFactory onGenerateRoute;
|
||||
public readonly InitialRouteListFactory onGenerateInitialRoutes;
|
||||
public readonly RouteFactory onUnknownRoute;
|
||||
public readonly List<NavigatorObserver> navigatorObservers;
|
||||
public readonly TransitionBuilder builder;
|
||||
|
@ -69,6 +84,14 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public readonly LocaleResolutionCallback localeResolutionCallback;
|
||||
public readonly List<Locale> supportedLocales;
|
||||
public readonly bool showPerformanceOverlay;
|
||||
public readonly bool checkerboardRasterCacheImages;
|
||||
public readonly bool checkerboardOffscreenLayers;
|
||||
public readonly bool showSemanticsDebugger;
|
||||
public readonly bool debugShowWidgetInspector;
|
||||
public readonly bool debugShowCheckedModeBanner;
|
||||
//TBC ????
|
||||
//public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
|
||||
//public readonly Dictionary<LocalKey, ActionFactory> actions;
|
||||
|
||||
public override State createState() {
|
||||
return new _CupertinoAppState();
|
||||
|
@ -111,7 +134,9 @@ namespace Unity.UIWidgets.cupertino {
|
|||
List<NavigatorObserver> _navigatorObservers;
|
||||
|
||||
void _updateNavigator() {
|
||||
if (widget.home != null || widget.routes.isNotEmpty() || widget.onGenerateRoute != null ||
|
||||
if (widget.home != null ||
|
||||
widget.routes.isNotEmpty() ||
|
||||
widget.onGenerateRoute != null ||
|
||||
widget.onUnknownRoute != null) {
|
||||
_navigatorObservers = new List<NavigatorObserver>();
|
||||
foreach (var item in widget.navigatorObservers) {
|
||||
|
@ -131,51 +156,68 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
_delegates.Add(DefaultCupertinoLocalizations.del);
|
||||
//_delegates.Add(DefaultMaterialLocalizations.del);
|
||||
return new List<LocalizationsDelegate>(_delegates);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
CupertinoThemeData effectiveThemeData = widget.theme ?? new CupertinoThemeData();
|
||||
|
||||
return new ScrollConfiguration(
|
||||
behavior: new _AlwaysCupertinoScrollBehavior(),
|
||||
child: new CupertinoTheme(
|
||||
data: effectiveThemeData,
|
||||
child: new WidgetsApp(
|
||||
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
|
||||
new CupertinoPageRoute(settings: settings, builder: builder),
|
||||
home: widget.home,
|
||||
routes: widget.routes,
|
||||
initialRoute: widget.initialRoute,
|
||||
onGenerateRoute: widget.onGenerateRoute,
|
||||
onUnknownRoute: widget.onUnknownRoute,
|
||||
builder: widget.builder,
|
||||
title: widget.title,
|
||||
onGenerateTitle: widget.onGenerateTitle,
|
||||
textStyle: effectiveThemeData.textTheme.textStyle,
|
||||
color: widget.color ?? CupertinoColors.activeBlue,
|
||||
locale: widget.locale,
|
||||
localizationsDelegates: _localizationsDelegates,
|
||||
localeResolutionCallback: widget.localeResolutionCallback,
|
||||
localeListResolutionCallback: widget.localeListResolutionCallback,
|
||||
supportedLocales: widget.supportedLocales,
|
||||
showPerformanceOverlay: widget.showPerformanceOverlay,
|
||||
inspectorSelectButtonBuilder: (BuildContext _context, VoidCallback onPressed) => {
|
||||
return CupertinoButton.filled(
|
||||
child: new Icon(
|
||||
CupertinoIcons.search,
|
||||
size: 28.0f,
|
||||
color: CupertinoColors.white
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed
|
||||
);
|
||||
}
|
||||
child: new CupertinoUserInterfaceLevel(
|
||||
data: CupertinoUserInterfaceLevelData.baselayer,
|
||||
child: new CupertinoTheme(
|
||||
data: effectiveThemeData,
|
||||
child: new Builder(
|
||||
builder: (BuildContext context1)=> {
|
||||
return new WidgetsApp(
|
||||
key: new GlobalObjectKey<State<StatefulWidget>>(value: this),
|
||||
navigatorKey: widget.navigatorKey,
|
||||
onGenerateRoute: widget.onGenerateRoute,
|
||||
onGenerateInitialRoutes: widget.onGenerateInitialRoutes,
|
||||
onUnknownRoute: widget.onUnknownRoute,
|
||||
navigatorObservers: _navigatorObservers,
|
||||
initialRoute: widget.initialRoute,
|
||||
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
|
||||
new CupertinoPageRoute(settings: settings, builder: builder),
|
||||
home: widget.home,
|
||||
routes: widget.routes,
|
||||
builder: widget.builder,
|
||||
title: widget.title,
|
||||
onGenerateTitle: widget.onGenerateTitle,
|
||||
textStyle: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
color: CupertinoDynamicColor.resolve(widget.color ?? effectiveThemeData.primaryColor, context),
|
||||
locale: widget.locale,
|
||||
localizationsDelegates: _localizationsDelegates,
|
||||
localeResolutionCallback: widget.localeResolutionCallback,
|
||||
localeListResolutionCallback: widget.localeListResolutionCallback,
|
||||
supportedLocales: widget.supportedLocales,
|
||||
showPerformanceOverlay: widget.showPerformanceOverlay,
|
||||
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
|
||||
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
|
||||
showSemanticsDebugger: widget.showSemanticsDebugger,
|
||||
debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner,
|
||||
inspectorSelectButtonBuilder: (BuildContext context2, VoidCallback onPressed)=>{
|
||||
return CupertinoButton.filled(
|
||||
child: new Icon(
|
||||
CupertinoIcons.search,
|
||||
size: 28.0f,
|
||||
color: CupertinoColors.white
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed
|
||||
);
|
||||
}
|
||||
///TBC????
|
||||
//shortcuts: widget.shortcuts,
|
||||
//actions: widget.actions
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,11 +10,18 @@ using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
|||
namespace Unity.UIWidgets.cupertino {
|
||||
class BottomAppBarUtils {
|
||||
public const float _kTabBarHeight = 50.0f;
|
||||
public static readonly Color _kDefaultTabBarBorderColor = new Color(0x4C000000);
|
||||
|
||||
public static readonly Color _kDefaultTabBarBorderColor =
|
||||
CupertinoDynamicColor.withBrightness(
|
||||
color: new Color(0x4C000000),
|
||||
darkColor: new Color(0x29000000)
|
||||
);
|
||||
public static readonly Color _kDefaultTabBarInactiveColor = CupertinoColors.inactiveGray;
|
||||
}
|
||||
|
||||
|
||||
public class CupertinoTabBar : StatelessWidget {
|
||||
public class CupertinoTabBar : StatelessWidget{
|
||||
|
||||
public CupertinoTabBar(
|
||||
Key key = null,
|
||||
List<BottomNavigationBarItem> items = null,
|
||||
|
@ -26,20 +33,19 @@ namespace Unity.UIWidgets.cupertino {
|
|||
float iconSize = 30.0f,
|
||||
Border border = null
|
||||
) : base(key: key) {
|
||||
|
||||
D.assert(items != null);
|
||||
D.assert(items.Count >= 2,
|
||||
() => "Tabs need at least 2 items to conform to Apple's HIG"
|
||||
);
|
||||
D.assert(0 <= currentIndex && currentIndex < items.Count);
|
||||
|
||||
|
||||
this.items = items;
|
||||
this.onTap = onTap;
|
||||
this.currentIndex = currentIndex;
|
||||
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.activeColor = activeColor;
|
||||
this.inactiveColor = inactiveColor ?? CupertinoColors.inactiveGray;
|
||||
this.inactiveColor = inactiveColor ?? BottomAppBarUtils._kDefaultTabBarInactiveColor;
|
||||
this.iconSize = iconSize;
|
||||
this.border = border ?? new Border(
|
||||
top: new BorderSide(
|
||||
|
@ -73,16 +79,34 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public bool opaque(BuildContext context) {
|
||||
Color backgroundColor =
|
||||
this.backgroundColor ?? CupertinoTheme.of(context).barBackgroundColor;
|
||||
return backgroundColor.alpha == 0xFF;
|
||||
return CupertinoDynamicColor.resolve(backgroundColor, context).alpha == 0xFF;
|
||||
}
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
float bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||
Color backgroundColor = CupertinoDynamicColor.resolve(
|
||||
this.backgroundColor ?? CupertinoTheme.of(context).barBackgroundColor,
|
||||
context
|
||||
);
|
||||
BorderSide resolveBorderSide(BorderSide side) {
|
||||
return side == BorderSide.none
|
||||
? side
|
||||
: side.copyWith(color: CupertinoDynamicColor.resolve(side.color, context));
|
||||
}
|
||||
Border resolvedBorder = border == null || border.GetType() != typeof(Border)
|
||||
? border
|
||||
: new Border(
|
||||
top: resolveBorderSide(border.top),
|
||||
left: resolveBorderSide(border.left),
|
||||
bottom: resolveBorderSide(border.bottom),
|
||||
right: resolveBorderSide(border.right)
|
||||
);
|
||||
|
||||
Color inactive = CupertinoDynamicColor.resolve(inactiveColor, context);
|
||||
Widget result = new DecoratedBox(
|
||||
decoration: new BoxDecoration(
|
||||
border: border,
|
||||
color: backgroundColor ?? CupertinoTheme.of(context).barBackgroundColor
|
||||
border: resolvedBorder,//border,
|
||||
color: backgroundColor //?? CupertinoTheme.of(context).barBackgroundColor
|
||||
),
|
||||
child: new SizedBox(
|
||||
height: BottomAppBarUtils._kTabBarHeight + bottomPadding,
|
||||
|
@ -92,8 +116,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
size: iconSize
|
||||
),
|
||||
child: new DefaultTextStyle( // Default with the inactive state.
|
||||
style: CupertinoTheme.of(context).textTheme.tabLabelTextStyle
|
||||
.copyWith(color: inactiveColor),
|
||||
style: CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(color: inactive),
|
||||
//CupertinoTheme.of(context).textTheme.tabLabelTextStyle
|
||||
child: new Padding(
|
||||
padding: EdgeInsets.only(bottom: bottomPadding),
|
||||
child: new Row(
|
||||
|
@ -128,6 +152,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
_wrapActiveItem(
|
||||
context,
|
||||
new Expanded(
|
||||
//// ??? semantics tbc ???
|
||||
child: new GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onTap == null ? null : (GestureTapCallback) (() => { onTap(tabIndex); }),
|
||||
|
@ -167,7 +192,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
return item;
|
||||
}
|
||||
|
||||
Color activeColor = this.activeColor ?? CupertinoTheme.of(context).primaryColor;
|
||||
//Color activeColor = this.activeColor ?? CupertinoTheme.of(context).primaryColor;
|
||||
Color activeColor = CupertinoDynamicColor.resolve(
|
||||
this.activeColor ?? CupertinoTheme.of(context).primaryColor,
|
||||
context
|
||||
);
|
||||
return IconTheme.merge(
|
||||
data: new IconThemeData(color: activeColor),
|
||||
child: DefaultTextStyle.merge(
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aae818985ea0fb942b943da7205b523c
|
||||
guid: 85a418ac598e2534d8eaa6b8deff74af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
|
@ -4,7 +4,6 @@ using Unity.UIWidgets.foundation;
|
|||
using Unity.UIWidgets.gestures;
|
||||
using Unity.UIWidgets.painting;
|
||||
using Unity.UIWidgets.rendering;
|
||||
using Unity.UIWidgets.scheduler2;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
||||
|
@ -12,60 +11,64 @@ using TickerFuture = Unity.UIWidgets.scheduler2.TickerFuture;
|
|||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
public class CupertinoButtonUtils {
|
||||
public static readonly Color _kDisabledBackground = new Color(0xFFA9A9A9);
|
||||
public static readonly Color _kDisabledForeground = new Color(0xFFD1D1D1);
|
||||
public static readonly EdgeInsets _kButtonPadding = EdgeInsets.all(16.0f);
|
||||
public static readonly EdgeInsets _kBackgroundButtonPadding = EdgeInsets.symmetric(vertical: 14.0f, horizontal: 64.0f);
|
||||
public static readonly EdgeInsets _kBackgroundButtonPadding = EdgeInsets.symmetric(
|
||||
vertical: 14.0f,
|
||||
horizontal: 64.0f);
|
||||
public static readonly float kMinInteractiveDimensionCupertino = 44.0f;
|
||||
}
|
||||
|
||||
public class CupertinoButton : StatefulWidget {
|
||||
public CupertinoButton(
|
||||
Widget child,
|
||||
VoidCallback onPressed,
|
||||
Key key = null,
|
||||
Widget child = null,
|
||||
EdgeInsets padding = null,
|
||||
Color color = null,
|
||||
Color disabledColor = null,
|
||||
float minSize = 44.0f,
|
||||
float pressedOpacity = 0.1f,
|
||||
float minSize = CupertinoButtonUtils.kMinInteractiveDimensionCupertino,
|
||||
float pressedOpacity = 0.4f,
|
||||
BorderRadius borderRadius = null,
|
||||
bool filled = false
|
||||
VoidCallback onPressed = null
|
||||
) : base(key: key) {
|
||||
D.assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
|
||||
_filled = filled;
|
||||
D.assert((pressedOpacity >= 0.0 && pressedOpacity <= 1.0) || pressedOpacity == null );
|
||||
D.assert(disabledColor != null);
|
||||
_filled = false;
|
||||
this.child = child;
|
||||
this.onPressed = onPressed;
|
||||
this.padding = padding;
|
||||
this.color = color;
|
||||
this.disabledColor = disabledColor;
|
||||
this.disabledColor = disabledColor ?? CupertinoColors.quaternarySystemFill;
|
||||
this.minSize = minSize;
|
||||
this.pressedOpacity = pressedOpacity;
|
||||
this.borderRadius = borderRadius ?? BorderRadius.all(Radius.circular(8.0f));
|
||||
}
|
||||
|
||||
public static CupertinoButton filled(
|
||||
Widget child,
|
||||
VoidCallback onPressed,
|
||||
Key key = null,
|
||||
Widget child = null,
|
||||
EdgeInsets padding = null,
|
||||
Color disabledColor = null,
|
||||
float minSize = 44.0f,
|
||||
float pressedOpacity = 0.1f,
|
||||
BorderRadius borderRadius = null
|
||||
float minSize = CupertinoButtonUtils.kMinInteractiveDimensionCupertino,
|
||||
float pressedOpacity = 0.4f,
|
||||
BorderRadius borderRadius = null,
|
||||
VoidCallback onPressed = null
|
||||
) {
|
||||
D.assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
|
||||
return new CupertinoButton(
|
||||
D.assert(disabledColor != null);
|
||||
|
||||
var btn = new CupertinoButton(
|
||||
key: key,
|
||||
color: null,
|
||||
child: child,
|
||||
onPressed: onPressed,
|
||||
padding: padding,
|
||||
disabledColor: disabledColor,
|
||||
minSize: minSize,
|
||||
pressedOpacity: pressedOpacity,
|
||||
borderRadius: borderRadius,
|
||||
filled: true
|
||||
onPressed: onPressed
|
||||
);
|
||||
btn._filled = true;
|
||||
return btn;
|
||||
}
|
||||
|
||||
public readonly Widget child;
|
||||
|
@ -80,10 +83,10 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public readonly float minSize;
|
||||
|
||||
public readonly float? pressedOpacity;
|
||||
public readonly float pressedOpacity;
|
||||
|
||||
public readonly BorderRadius borderRadius;
|
||||
public readonly bool _filled;
|
||||
public bool _filled;
|
||||
|
||||
public bool enabled {
|
||||
get { return onPressed != null; }
|
||||
|
@ -102,7 +105,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
class _CupertinoButtonState : SingleTickerProviderStateMixin<CupertinoButton> {
|
||||
static readonly TimeSpan kFadeOutDuration = new TimeSpan(0, 0, 0, 0, 10);
|
||||
static readonly TimeSpan kFadeInDuration = new TimeSpan(0, 0, 0, 0, 100);
|
||||
public readonly FloatTween _opacityTween = new FloatTween(begin: 1.0f, end: 0.0f);
|
||||
public readonly Tween<float> _opacityTween = new Tween<float>(begin: 1.0f, end: 0.0f);
|
||||
AnimationController _animationController;
|
||||
Animation<float> _opacityAnimation;
|
||||
|
||||
|
@ -112,6 +115,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
duration: new TimeSpan(0, 0, 0, 0, 200),
|
||||
value: 0.0f,
|
||||
vsync: this);
|
||||
|
||||
_opacityAnimation = _animationController
|
||||
.drive(new CurveTween(curve: Curves.decelerate))
|
||||
.drive(_opacityTween);
|
||||
|
@ -183,17 +187,21 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public override Widget build(BuildContext context) {
|
||||
bool enabled = widget.enabled;
|
||||
Color primaryColor = CupertinoTheme.of(context).primaryColor;
|
||||
Color backgroundColor = widget.color ?? (widget._filled ? primaryColor : null);
|
||||
CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
Color primaryColor = themeData.primaryColor;
|
||||
Color backgroundColor = (widget.color == null)
|
||||
? (widget._filled ? primaryColor : null)
|
||||
: CupertinoDynamicColor.resolve(widget.color, context);
|
||||
|
||||
Color foregroundColor = backgroundColor != null
|
||||
? CupertinoTheme.of(context).primaryContrastingColor
|
||||
? themeData.primaryContrastingColor
|
||||
: enabled
|
||||
? primaryColor
|
||||
: CupertinoButtonUtils._kDisabledForeground;
|
||||
: CupertinoDynamicColor.resolve(CupertinoColors.placeholderText, context);
|
||||
|
||||
TextStyle textStyle =
|
||||
CupertinoTheme.of(context).textTheme.textStyle.copyWith(color: foregroundColor);
|
||||
themeData.textTheme.textStyle.copyWith(color: foregroundColor);
|
||||
|
||||
return new GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: enabled ? _handleTapDown : (GestureTapDownCallback) null,
|
||||
|
@ -206,8 +214,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
widget.onPressed();
|
||||
}
|
||||
},
|
||||
////tbc semantics
|
||||
child: new ConstrainedBox(
|
||||
constraints: new BoxConstraints(
|
||||
constraints: widget.minSize == null
|
||||
? new BoxConstraints() :
|
||||
new BoxConstraints(
|
||||
minWidth: widget.minSize,
|
||||
minHeight: widget.minSize
|
||||
),
|
||||
|
@ -217,7 +228,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
decoration: new BoxDecoration(
|
||||
borderRadius: widget.borderRadius,
|
||||
color: backgroundColor != null && !enabled
|
||||
? widget.disabledColor ?? CupertinoButtonUtils._kDisabledBackground
|
||||
? CupertinoDynamicColor.resolve(widget.disabledColor, context)
|
||||
: backgroundColor
|
||||
),
|
||||
child: new Padding(
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
using Unity.UIWidgets.ui;
|
||||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
public class CupertinoColors {
|
||||
public static readonly Color activeBlue = new Color(0xFF007AFF);
|
||||
|
||||
public static readonly Color activeGreen = new Color(0xFF4CD964);
|
||||
|
||||
public static readonly Color activeOrange = new Color(0xFFFF9500);
|
||||
|
||||
public static readonly Color white = new Color(0xFFFFFFFF);
|
||||
|
||||
public static readonly Color black = new Color(0xFF000000);
|
||||
|
||||
public static readonly Color lightBackgroundGray = new Color(0xFFE5E5EA);
|
||||
|
||||
public static readonly Color extraLightBackgroundGray = new Color(0xFFEFEFF4);
|
||||
|
||||
public static readonly Color darkBackgroundGray = new Color(0xFF171717);
|
||||
|
||||
public static readonly Color inactiveGray = new Color(0xFF8E8E93);
|
||||
|
||||
public static readonly Color destructiveRed = new Color(0xFFFF3B30);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,763 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using Unity.UIWidgets.painting;
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
public class CupertinoColors {
|
||||
public static CupertinoDynamicColor activeBlue = systemBlue;
|
||||
public static CupertinoDynamicColor activeGreen = systemGreen;
|
||||
public static 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 CupertinoDynamicColor inactiveGray = CupertinoDynamicColor.withBrightness(
|
||||
debugLabel: "inactiveGray",
|
||||
color: new Color(0xFF999999),
|
||||
darkColor: new Color(0xFF757575)
|
||||
);
|
||||
|
||||
public static CupertinoDynamicColor destructiveRed = systemRed;
|
||||
|
||||
public static 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 CupertinoDynamicColor label = new CupertinoDynamicColor(
|
||||
debugLabel: "label",
|
||||
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 CupertinoDynamicColor secondaryLabel = new CupertinoDynamicColor(
|
||||
debugLabel: "secondaryLabel",
|
||||
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 CupertinoDynamicColor tertiaryLabel = new CupertinoDynamicColor(
|
||||
debugLabel: "tertiaryLabel",
|
||||
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 CupertinoDynamicColor quaternaryLabel = new CupertinoDynamicColor(
|
||||
debugLabel: "quaternaryLabel",
|
||||
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 CupertinoDynamicColor systemFill = new CupertinoDynamicColor(
|
||||
debugLabel: "systemFill",
|
||||
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 CupertinoDynamicColor secondarySystemFill = new CupertinoDynamicColor(
|
||||
debugLabel: "secondarySystemFill",
|
||||
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 CupertinoDynamicColor tertiarySystemFill = new CupertinoDynamicColor(
|
||||
debugLabel: "tertiarySystemFill",
|
||||
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 CupertinoDynamicColor quaternarySystemFill = new CupertinoDynamicColor(
|
||||
debugLabel: "quaternarySystemFill",
|
||||
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 CupertinoDynamicColor placeholderText = new CupertinoDynamicColor(
|
||||
debugLabel: "placeholderText",
|
||||
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 CupertinoDynamicColor systemBackground = new CupertinoDynamicColor(
|
||||
debugLabel: "systemBackground",
|
||||
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 CupertinoDynamicColor secondarySystemBackground = new CupertinoDynamicColor(
|
||||
debugLabel: "secondarySystemBackground",
|
||||
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 CupertinoDynamicColor tertiarySystemBackground = new CupertinoDynamicColor(
|
||||
debugLabel: "tertiarySystemBackground",
|
||||
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 CupertinoDynamicColor systemGroupedBackground = new CupertinoDynamicColor(
|
||||
debugLabel: "systemGroupedBackground",
|
||||
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 CupertinoDynamicColor secondarySystemGroupedBackground = new CupertinoDynamicColor(
|
||||
debugLabel: "secondarySystemGroupedBackground",
|
||||
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 CupertinoDynamicColor tertiarySystemGroupedBackground = new CupertinoDynamicColor(
|
||||
debugLabel: "tertiarySystemGroupedBackground",
|
||||
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 CupertinoDynamicColor separator = new CupertinoDynamicColor(
|
||||
debugLabel: "separator",
|
||||
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 CupertinoDynamicColor opaqueSeparator = new CupertinoDynamicColor(
|
||||
debugLabel: "opaqueSeparator",
|
||||
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 CupertinoDynamicColor link =
|
||||
new CupertinoDynamicColor(
|
||||
debugLabel: "link",
|
||||
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 class CupertinoDynamicColor : Color, Diagnosticable {
|
||||
|
||||
public CupertinoDynamicColor(
|
||||
string debugLabel = 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
|
||||
) : base(0) {
|
||||
/// ._
|
||||
D.assert(color != null);
|
||||
D.assert(darkColor != null);
|
||||
D.assert(highContrastColor != null);
|
||||
D.assert(darkHighContrastColor != null);
|
||||
D.assert(elevatedColor != null);
|
||||
D.assert(darkElevatedColor != null);
|
||||
D.assert(highContrastElevatedColor != null);
|
||||
D.assert(darkHighContrastElevatedColor != null);
|
||||
D.assert(_effectiveColor != null);
|
||||
_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 = null;
|
||||
_debugLabel = debugLabel;
|
||||
}
|
||||
|
||||
public static CupertinoDynamicColor create(
|
||||
Color _effectiveColor,
|
||||
Color color,
|
||||
Color darkColor ,
|
||||
Color highContrastColor ,
|
||||
Color darkHighContrastColor ,
|
||||
Color elevatedColor ,
|
||||
Color darkElevatedColor ,
|
||||
Color highContrastElevatedColor ,
|
||||
Color darkHighContrastElevatedColor ,
|
||||
Element _debugResolveContext ,
|
||||
string _debugLabel
|
||||
) {
|
||||
var dynamicColor = new CupertinoDynamicColor(
|
||||
debugLabel: _debugLabel,
|
||||
color: color,
|
||||
darkColor: darkColor,
|
||||
highContrastColor: color,
|
||||
darkHighContrastColor: darkColor,
|
||||
elevatedColor: color,
|
||||
darkElevatedColor: darkColor,
|
||||
highContrastElevatedColor: color,
|
||||
darkHighContrastElevatedColor: darkColor
|
||||
);
|
||||
dynamicColor._effectiveColor = _effectiveColor;
|
||||
dynamicColor._debugResolveContext = _debugResolveContext;
|
||||
return dynamicColor;
|
||||
|
||||
}
|
||||
|
||||
public static CupertinoDynamicColor withBrightnessAndContrast(
|
||||
string debugLabel = null,
|
||||
Color color = null,
|
||||
Color darkColor = null,
|
||||
Color highContrastColor = null,
|
||||
Color darkHighContrastColor = null
|
||||
) {
|
||||
|
||||
return new CupertinoDynamicColor(
|
||||
debugLabel: debugLabel,
|
||||
color: color,
|
||||
darkColor: darkColor,
|
||||
highContrastColor: highContrastColor,
|
||||
darkHighContrastColor: darkHighContrastColor,
|
||||
elevatedColor: color,
|
||||
darkElevatedColor: darkColor,
|
||||
highContrastElevatedColor: highContrastColor,
|
||||
darkHighContrastElevatedColor: darkHighContrastColor
|
||||
);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public Color _effectiveColor;
|
||||
|
||||
|
||||
public int value {
|
||||
get { return (int) _effectiveColor.value; }
|
||||
}
|
||||
|
||||
|
||||
public readonly string _debugLabel;
|
||||
|
||||
public Element _debugResolveContext;
|
||||
public readonly Color color;
|
||||
|
||||
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);
|
||||
return (resolvable is CupertinoDynamicColor)
|
||||
? ((CupertinoDynamicColor) resolvable).resolveFrom(context, nullOk: nullOk)
|
||||
: resolvable;
|
||||
}
|
||||
|
||||
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? CupertinoUserInterfacelevel =
|
||||
CupertinoUserInterfaceLevel.of(context, nullOk: nullOk);
|
||||
CupertinoUserInterfaceLevelData level = _isInterfaceElevationDependent
|
||||
? CupertinoUserInterfacelevel ?? 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 create(
|
||||
resolved,
|
||||
color,
|
||||
darkColor,
|
||||
highContrastColor,
|
||||
darkHighContrastColor,
|
||||
elevatedColor,
|
||||
darkElevatedColor,
|
||||
highContrastElevatedColor,
|
||||
darkHighContrastElevatedColor,
|
||||
_debugContext,
|
||||
_debugLabel
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
public bool Equals(CupertinoDynamicColor other) {
|
||||
if (ReferenceEquals(null, other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(this, other)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Equals(value, other.value) && 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 = (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 string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
|
||||
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 string toStringColor(string name, Color color) {
|
||||
string marker = color == _effectiveColor ? "*" : "";
|
||||
return marker + name + " = " + color.ToString() + marker;
|
||||
}
|
||||
|
||||
|
||||
public new 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 = null,
|
||||
Color value = null,
|
||||
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: value._debugLabel,
|
||||
showName: showName,
|
||||
defaultValue: defaultValue,
|
||||
style: style,
|
||||
level: level
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
return new ColorProperty(
|
||||
name,
|
||||
value,
|
||||
showName: showName,
|
||||
defaultValue: defaultValue,
|
||||
style: style,
|
||||
level: level
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cf635163f4e847c4d8189105ba042987
|
||||
guid: 78e6aef01ceaee54bbcae56c25aa6147
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24797e4675ab3314ea1a636afd32bfee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,151 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.UIWidgets.animation;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.gestures;
|
||||
using Unity.UIWidgets.painting;
|
||||
using Unity.UIWidgets.rendering;
|
||||
using Unity.UIWidgets.scheduler2;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
||||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
|
||||
public class CupertinoContextMenuAction : StatefulWidget {
|
||||
|
||||
public CupertinoContextMenuAction(
|
||||
Key key = null,
|
||||
Widget child = null,
|
||||
bool isDefaultAction = false,
|
||||
bool isDestructiveAction = false,
|
||||
VoidCallback onPressed = null,
|
||||
IconData trailingIcon = null
|
||||
) : base(key: key) {
|
||||
D.assert(child != null);
|
||||
D.assert(isDefaultAction != null);
|
||||
D.assert(isDestructiveAction != null);
|
||||
this.child = child;
|
||||
this.isDefaultAction = isDefaultAction;
|
||||
this.isDestructiveAction = isDestructiveAction;
|
||||
this.onPressed = onPressed;
|
||||
this.trailingIcon = trailingIcon;
|
||||
|
||||
}
|
||||
public readonly Widget child;
|
||||
public readonly bool isDefaultAction;
|
||||
public readonly bool isDestructiveAction;
|
||||
public readonly VoidCallback onPressed;
|
||||
public readonly IconData trailingIcon;
|
||||
|
||||
public override State createState() {
|
||||
return new _CupertinoContextMenuActionState();
|
||||
}
|
||||
}
|
||||
public class _CupertinoContextMenuActionState : State<CupertinoContextMenuAction> {
|
||||
public static Color _kBackgroundColor = new Color(0xFFEEEEEE);
|
||||
public static Color _kBackgroundColorPressed = new Color(0xFFDDDDDD);
|
||||
public static float _kButtonHeight = 56.0f;
|
||||
|
||||
public static readonly TextStyle _kActionSheetActionStyle = new TextStyle(
|
||||
fontFamily: ".SF UI Text",
|
||||
inherit: false,
|
||||
fontSize: 20.0f,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: CupertinoColors.black,
|
||||
textBaseline: TextBaseline.alphabetic
|
||||
);
|
||||
public GlobalKey _globalKey = new LabeledGlobalKey<State<StatefulWidget>>();
|
||||
//GlobalKey();
|
||||
bool _isPressed = false;
|
||||
|
||||
void onTapDown(TapDownDetails details) {
|
||||
setState(()=>{
|
||||
_isPressed = true;
|
||||
});
|
||||
}
|
||||
|
||||
void onTapUp(TapUpDetails details) {
|
||||
setState(()=>{
|
||||
_isPressed = false;
|
||||
});
|
||||
}
|
||||
|
||||
void onTapCancel() {
|
||||
setState(()=>{
|
||||
_isPressed = false;
|
||||
});
|
||||
}
|
||||
|
||||
TextStyle _textStyle {
|
||||
get {
|
||||
if (widget.isDefaultAction) {
|
||||
return _kActionSheetActionStyle.copyWith(
|
||||
fontWeight: FontWeight.w600
|
||||
);
|
||||
}
|
||||
if (widget.isDestructiveAction) {
|
||||
return _kActionSheetActionStyle.copyWith(
|
||||
color: CupertinoColors.destructiveRed
|
||||
);
|
||||
}
|
||||
return _kActionSheetActionStyle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
List<Widget> widgets = new List<Widget>();
|
||||
widgets.Add(new Flexible(child: widget.child));
|
||||
if (widget.trailingIcon != null) {
|
||||
widgets.Add(new Icon(
|
||||
widget.trailingIcon,
|
||||
color: _textStyle.color));
|
||||
}
|
||||
|
||||
return new GestureDetector(
|
||||
key: _globalKey,
|
||||
onTapDown: onTapDown,
|
||||
onTapUp: onTapUp,
|
||||
onTapCancel: onTapCancel,
|
||||
onTap: //widget.onPressed,
|
||||
widget.onPressed == null
|
||||
? (GestureTapCallback) null
|
||||
: () => {
|
||||
if (widget.onPressed != null) {
|
||||
widget.onPressed();
|
||||
}
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: /////semantics tbc ???
|
||||
new ConstrainedBox(
|
||||
constraints: new BoxConstraints(
|
||||
minHeight: _kButtonHeight
|
||||
),
|
||||
child:
|
||||
new Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 16.0f,
|
||||
horizontal: 10.0f
|
||||
),
|
||||
decoration: new BoxDecoration(
|
||||
color: _isPressed ? _kBackgroundColorPressed : _kBackgroundColor,
|
||||
border: new Border(
|
||||
bottom: new BorderSide(width: 1.0f, color: _kBackgroundColorPressed)
|
||||
)
|
||||
),
|
||||
child: new DefaultTextStyle(
|
||||
style: _textStyle,
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children:widgets
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d5246034a96caf946b0142d694f1acac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -14,19 +14,20 @@ using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
|||
namespace Unity.UIWidgets.cupertino {
|
||||
class CupertinoDialogUtils {
|
||||
public static readonly TextStyle _kCupertinoDialogTitleStyle = new TextStyle(
|
||||
inherit:false,
|
||||
fontFamily: ".SF UI Display",
|
||||
fontSize: 18.0f,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: CupertinoColors.black,
|
||||
letterSpacing: 0.48f,
|
||||
textBaseline: TextBaseline.alphabetic
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kCupertinoDialogContentStyle = new TextStyle(
|
||||
fontFamily: ".SF UI Text",
|
||||
inherit:false,
|
||||
fontSize: 13.4f,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: CupertinoColors.black,
|
||||
//color: CupertinoColors.black,
|
||||
height: 1.036f,
|
||||
letterSpacing: -0.25f,
|
||||
textBaseline: TextBaseline.alphabetic
|
||||
|
@ -34,6 +35,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public static readonly TextStyle _kCupertinoDialogActionStyle = new TextStyle(
|
||||
fontFamily: ".SF UI Text",
|
||||
inherit:false,
|
||||
fontSize: 16.8f,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: CupertinoColors.activeBlue,
|
||||
|
@ -56,10 +58,19 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public const float _kDividerThickness = 1.0f;
|
||||
public const float _kMaxRegularTextScaleFactor = 1.4f;
|
||||
|
||||
public static readonly Color _kDialogColor = new Color(0xC0FFFFFF);
|
||||
public static readonly Color _kDialogPressedColor = new Color(0x90FFFFFF);
|
||||
//public static readonly Color _kDialogColor = new Color(0xC0FFFFFF);
|
||||
//public static readonly Color _kDialogPressedColor = new Color(0x90FFFFFF);
|
||||
public static readonly Color _kButtonDividerColor = new Color(0x40FFFFFF);
|
||||
|
||||
public static readonly Color _kDialogColor = CupertinoDynamicColor.withBrightness(
|
||||
color: new Color(0xCCF2F2F2),
|
||||
darkColor: new Color(0xBF1E1E1E)
|
||||
);
|
||||
public static readonly Color _kDialogPressedColor = CupertinoDynamicColor.withBrightness(
|
||||
color: new Color(0xFFE1E1E1),
|
||||
darkColor: new Color(0xFF2E2E2E)
|
||||
);
|
||||
|
||||
public static bool _isInAccessibilityMode(BuildContext context) {
|
||||
MediaQueryData data = MediaQuery.of(context, nullOk: true);
|
||||
return data != null && data.textScaleFactor > _kMaxRegularTextScaleFactor;
|
||||
|
@ -300,7 +311,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
_AlertDialogSections.actionsSection);
|
||||
}
|
||||
|
||||
protected override void forgetChild(Element child) {
|
||||
public override void forgetChild(Element child) {
|
||||
D.assert(child == _contentElement || child == _actionsElement);
|
||||
if (_contentElement == child) {
|
||||
_contentElement = null;
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.service;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using Brightness = Unity.UIWidgets.ui.Brightness;
|
||||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
class CupertinoIconThemeData : IconThemeData {
|
||||
|
||||
public CupertinoIconThemeData(
|
||||
Color color = null,
|
||||
float? opacity = null,
|
||||
float? size = null
|
||||
) : base(color: color, opacity: opacity, size: size) {
|
||||
|
||||
}
|
||||
|
||||
public new IconThemeData resolve(BuildContext context) {
|
||||
Color resolvedColor = CupertinoDynamicColor.resolve(color, context);
|
||||
return resolvedColor == color ? this : copyWith(color: resolvedColor);
|
||||
}
|
||||
public new CupertinoIconThemeData copyWith(Color color = null , float? opacity = null, float? size = null)
|
||||
{
|
||||
return new CupertinoIconThemeData(
|
||||
color: color ?? this.color,
|
||||
opacity: opacity ?? this.opacity,
|
||||
size: size ?? this.size
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
base.debugFillProperties(properties);
|
||||
properties.add(CupertinoDynamicColor.createCupertinoColorProperty("color", color, defaultValue: null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 696a8c3b3fd073847bc390f64a2b112f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,65 @@
|
|||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
public enum CupertinoUserInterfaceLevelData {
|
||||
baselayer,
|
||||
elevatedlayer,
|
||||
|
||||
}
|
||||
public class CupertinoUserInterfaceLevel : InheritedWidget {
|
||||
|
||||
public CupertinoUserInterfaceLevel(
|
||||
Key key = null,
|
||||
CupertinoUserInterfaceLevelData data = default,
|
||||
Widget child = null
|
||||
) : base(key: key, child: child)
|
||||
{
|
||||
D.assert(data != null);
|
||||
_data = data;
|
||||
}
|
||||
public CupertinoUserInterfaceLevelData _data;
|
||||
|
||||
public static CupertinoUserInterfaceLevelData? of(BuildContext context, bool nullOk = false ) {
|
||||
D.assert(context != null);
|
||||
D.assert(nullOk != null);
|
||||
CupertinoUserInterfaceLevel query = context.dependOnInheritedWidgetOfExactType<CupertinoUserInterfaceLevel>(null);
|
||||
if (query != null)
|
||||
return query._data;
|
||||
//if (nullOk)
|
||||
// return ;
|
||||
throw new UIWidgetsError(
|
||||
"CupertinoUserInterfaceLevel.of() called with a context that does not contain a CupertinoUserInterfaceLevel.\n" +
|
||||
"No CupertinoUserInterfaceLevel ancestor could be found starting from the context that was passed "+
|
||||
"to CupertinoUserInterfaceLevel.of(). This can happen because you do not have a WidgetsApp or "+
|
||||
"MaterialApp widget (those widgets introduce a CupertinoUserInterfaceLevel), or it can happen "+
|
||||
"if the context you use comes from a widget above those widgets.\n"+
|
||||
"The context used was:\n"+
|
||||
context.ToString()
|
||||
);
|
||||
}
|
||||
|
||||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
base.debugFillProperties(properties);
|
||||
properties.add(new EnumProperty<CupertinoUserInterfaceLevelData>("user interface level", _data));
|
||||
}
|
||||
|
||||
public override bool updateShouldNotify(InheritedWidget oldWidget) {
|
||||
//throw new System.NotImplementedException();
|
||||
//oldWidget._data != _data;
|
||||
/// ?????
|
||||
if (oldWidget.GetType() == typeof(CupertinoUserInterfaceLevel)) {
|
||||
return updateShouldNotify(oldWidget);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public bool updateShouldNotify(CupertinoUserInterfaceLevel oldWidget) => oldWidget._data != _data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 28fded021801d9047ab539e8b57eda6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -79,10 +79,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
return locale.languageCode == "en";
|
||||
}
|
||||
|
||||
/* public override Future<CupertinoLocalizations> loadT(Locale locale) {
|
||||
return DefaultCupertinoLocalizations.load(locale);
|
||||
}*/
|
||||
//public override Future<> load(Locale locale) {
|
||||
|
||||
public override Future<WidgetsLocalizations> load(Locale locale) {
|
||||
return DefaultCupertinoLocalizations.load(locale).to<WidgetsLocalizations>();
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
public class CupertinoNavigationBar : StatefulWidget {
|
||||
public class CupertinoNavigationBar : ObstructingPreferredSizeWidget {
|
||||
public CupertinoNavigationBar(
|
||||
Key key = null,
|
||||
Widget leading = null,
|
||||
|
@ -238,10 +238,6 @@ namespace Unity.UIWidgets.cupertino {
|
|||
bool transitionBetweenRoutes = true,
|
||||
object heroTag = null
|
||||
) : base(key: key) {
|
||||
//D.assert(automaticallyImplyLeading != null);
|
||||
//D.assert(automaticallyImplyMiddle != null);
|
||||
//D.assert(transitionBetweenRoutes != null);
|
||||
|
||||
this.leading = leading;
|
||||
this.automaticallyImplyLeading = automaticallyImplyLeading;
|
||||
this.automaticallyImplyMiddle = automaticallyImplyMiddle;
|
||||
|
@ -254,17 +250,18 @@ namespace Unity.UIWidgets.cupertino {
|
|||
this.actionsForegroundColor = actionsForegroundColor;
|
||||
this.transitionBetweenRoutes = transitionBetweenRoutes;
|
||||
this.heroTag = heroTag ?? NavBarUtils._defaultHeroTag;
|
||||
|
||||
D.assert(
|
||||
this.heroTag != null,
|
||||
() => "heroTag cannot be null. Use transitionBetweenRoutes = false to " +
|
||||
"disable Hero transition on this navigation bar."
|
||||
);
|
||||
|
||||
D.assert(
|
||||
!transitionBetweenRoutes || ReferenceEquals(this.heroTag, NavBarUtils._defaultHeroTag),
|
||||
() => "Cannot specify a heroTag override if this navigation bar does not " +
|
||||
"transition due to transitionBetweenRoutes = false."
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public readonly Widget leading;
|
||||
|
@ -292,13 +289,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public readonly object heroTag;
|
||||
|
||||
//public override bool? fullObstruction {
|
||||
public bool? fullObstruction {
|
||||
public override bool? fullObstruction {
|
||||
get { return backgroundColor == null ? null : (bool?) (backgroundColor.alpha == 0xFF); }
|
||||
}
|
||||
|
||||
//public override Size preferredSize {
|
||||
public Size preferredSize {
|
||||
public override Size preferredSize {
|
||||
get { return Size.fromHeight(NavBarUtils._kNavBarPersistentHeight); }
|
||||
}
|
||||
|
||||
|
@ -1709,9 +1704,10 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
RenderAnimatedOpacity topBackLabelOpacity =
|
||||
(RenderAnimatedOpacity) topComponents.backLabelKey.currentContext?.ancestorRenderObjectOfType(
|
||||
(RenderAnimatedOpacity) topComponents.backLabelKey.currentContext?.findAncestorRenderObjectOfType<RenderAnimatedOpacity>();
|
||||
/*ancestorRenderObjectOfType(
|
||||
new TypeMatcher<RenderAnimatedOpacity>()
|
||||
);
|
||||
);*/
|
||||
|
||||
Animation<float> midClickOpacity = null;
|
||||
if (topBackLabelOpacity != null && topBackLabelOpacity.opacity.value < 1.0f) {
|
||||
|
|
|
@ -12,21 +12,18 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public CupertinoPageScaffold(
|
||||
Widget child,
|
||||
Key key = null,
|
||||
//ObstructingPreferredSizeWidget navigationBar = null,
|
||||
CupertinoNavigationBar navigationBar = null,
|
||||
ObstructingPreferredSizeWidget navigationBar = null,
|
||||
Color backgroundColor = null,
|
||||
bool resizeToAvoidBottomInset = true
|
||||
) : base(key: key) {
|
||||
D.assert(child != null);
|
||||
|
||||
this.child = child;
|
||||
this.navigationBar = navigationBar;
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.resizeToAvoidBottomInset = resizeToAvoidBottomInset;
|
||||
}
|
||||
|
||||
//public readonly ObstructingPreferredSizeWidget navigationBar;
|
||||
public readonly CupertinoNavigationBar navigationBar;
|
||||
public readonly ObstructingPreferredSizeWidget navigationBar;
|
||||
public readonly Widget child;
|
||||
public readonly Color backgroundColor;
|
||||
public readonly bool resizeToAvoidBottomInset;
|
||||
|
@ -122,7 +119,6 @@ namespace Unity.UIWidgets.cupertino {
|
|||
right: 0.0f,
|
||||
height: existingMediaQuery.padding.top,
|
||||
child: new GestureDetector(
|
||||
//excludeFromSemantics: true,
|
||||
onTap: _handleStatusBarTap
|
||||
)
|
||||
)
|
||||
|
@ -141,10 +137,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public abstract class ObstructingPreferredSizeWidget : PreferredSizeWidget {
|
||||
|
||||
protected ObstructingPreferredSizeWidget(Key key = null) : base(key: key) {}
|
||||
//public virtual Size preferredSize { get; }
|
||||
public virtual bool? fullObstruction { get; }
|
||||
///protected ObstructingPreferredSizeWidget(Key key = null) : base(key: key) {}
|
||||
// public virtual bool? fullObstruction { get; }
|
||||
public abstract bool shouldFullyObstruct(BuildContext context);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -70,7 +70,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static readonly Animatable<float> _dialogScaleTween = new FloatTween(begin: 1.3f, end: 1.0f)
|
||||
.chain(new CurveTween(curve: Curves.linearToEaseOut));
|
||||
|
@ -98,12 +98,12 @@ namespace Unity.UIWidgets.cupertino {
|
|||
);
|
||||
}
|
||||
|
||||
public static Future<object> showCupertinoDialog(
|
||||
public static Future showCupertinoDialog(
|
||||
BuildContext context,
|
||||
WidgetBuilder builder
|
||||
) {
|
||||
D.assert(builder != null);
|
||||
return DialogUtils.showGeneralDialog(
|
||||
return _DialogRoute.showGeneralDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
barrierColor: _kModalBarrierColor,
|
||||
|
@ -268,7 +268,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
protected internal override void didChangePrevious(Route previousRoute) {
|
||||
protected internal override void didChangePrevious(Route previousRoute) {
|
||||
string previousTitleString = previousRoute is CupertinoPageRoute
|
||||
? ((CupertinoPageRoute) previousRoute).title
|
||||
: null;
|
||||
|
@ -299,14 +299,13 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
|
||||
|
||||
public override bool canTransitionFrom(TransitionRoute previousRoute) {
|
||||
return previousRoute is CupertinoPageRoute;
|
||||
}
|
||||
/*public override bool canTransitionFrom(TransitionRoute<object> previousRoute) {
|
||||
return previousRoute is CupertinoPageRoute<object>;
|
||||
}*/
|
||||
|
||||
|
||||
public override bool canTransitionTo(TransitionRoute nextRoute) {
|
||||
return nextRoute is CupertinoPageRoute && !((CupertinoPageRoute) nextRoute).fullscreenDialog;
|
||||
}
|
||||
/*public override bool canTransitionTo(TransitionRoute<object> nextRoute) {
|
||||
return nextRoute is CupertinoPageRoute<object> && !((CupertinoPageRoute<object>) nextRoute).fullscreenDialog;
|
||||
}*/
|
||||
|
||||
static bool isPopGestureInProgress(PageRoute route) {
|
||||
return route.navigator.userGestureInProgress;
|
||||
|
@ -314,11 +313,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
|
||||
public bool popGestureInProgress {
|
||||
get { return isPopGestureInProgress(this); }
|
||||
get { return isPopGestureInProgress(this as PageRoute); }
|
||||
}
|
||||
|
||||
public bool popGestureEnabled {
|
||||
get { return _isPopGestureEnabled(this); }
|
||||
get { return _isPopGestureEnabled(this as PageRoute); }
|
||||
}
|
||||
|
||||
static bool _isPopGestureEnabled(PageRoute route) {
|
||||
|
@ -346,7 +345,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isPopGestureInProgress(route)) {
|
||||
if (isPopGestureInProgress(route )) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -385,6 +384,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
Animation<float> secondaryAnimation,
|
||||
Widget child
|
||||
) {
|
||||
bool linearTransition = isPopGestureInProgress(route);
|
||||
if (route.fullscreenDialog) {
|
||||
return new CupertinoFullscreenDialogTransition(
|
||||
animation: animation,
|
||||
|
@ -396,7 +396,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
return new CupertinoPageTransition(
|
||||
primaryRouteAnimation: animation,
|
||||
secondaryRouteAnimation: secondaryAnimation,
|
||||
linearTransition: isPopGestureInProgress(route),
|
||||
linearTransition: linearTransition,
|
||||
child: new _CupertinoBackGestureDetector(
|
||||
enabledCallback: () => _isPopGestureEnabled(route),
|
||||
onStartPopGesture: () => _startPopGesture(route),
|
||||
|
@ -418,10 +418,10 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
class CupertinoPageTransition : StatelessWidget {
|
||||
public CupertinoPageTransition(
|
||||
Animation<float> primaryRouteAnimation = null,
|
||||
Animation<float> secondaryRouteAnimation = null,
|
||||
Widget child = null,
|
||||
bool linearTransition = default,
|
||||
Animation<float> primaryRouteAnimation,
|
||||
Animation<float> secondaryRouteAnimation,
|
||||
Widget child,
|
||||
bool linearTransition,
|
||||
Key key = null
|
||||
) : base(key: key) {
|
||||
_primaryPositionAnimation =
|
||||
|
@ -687,7 +687,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
}
|
||||
}
|
||||
|
||||
class _CupertinoModalPopupRoute : PopupRoute {
|
||||
class _CupertinoModalPopupRoute : PopupRoute{
|
||||
public _CupertinoModalPopupRoute(
|
||||
WidgetBuilder builder = null,
|
||||
string barrierLabel = null,
|
||||
|
@ -754,4 +754,6 @@ namespace Unity.UIWidgets.cupertino {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -42,9 +42,10 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
AnimationController _fadeoutAnimationController;
|
||||
Animation<float> _fadeoutOpacityAnimation;
|
||||
double _dragScrollbarPositionY;
|
||||
float _dragScrollbarPositionY;
|
||||
Timer _fadeoutTimer;
|
||||
|
||||
|
||||
|
||||
public override void initState() {
|
||||
base.initState();
|
||||
|
@ -90,7 +91,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
_painter.update(notification.metrics, notification.metrics.axisDirection);
|
||||
}
|
||||
else if (notification is ScrollEndNotification) {
|
||||
if (_dragScrollbarPositionY == null) {
|
||||
if (_dragScrollbarPositionY.Equals(0f)) {
|
||||
_startFadeoutTimer();
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
return true;
|
||||
});
|
||||
return result;
|
||||
return result ;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.service;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using Brightness = Unity.UIWidgets.ui.Brightness;
|
||||
using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
||||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
static class CupertinoTextThemeDataUtils {
|
||||
public static readonly TextStyle _kDefaultLightTextStyle = new TextStyle(
|
||||
/*public static readonly TextStyle _kDefaultLightTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontSize: 17.0f,
|
||||
|
@ -75,7 +76,73 @@ namespace Unity.UIWidgets.cupertino {
|
|||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.41f,
|
||||
color: CupertinoColors.white
|
||||
);*/
|
||||
public static readonly TextStyle _kDefaultTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontSize: 17.0f,
|
||||
letterSpacing: -0.41f,
|
||||
color: CupertinoColors.label,
|
||||
decoration: TextDecoration.none
|
||||
);
|
||||
public static readonly TextStyle _kDefaultActionTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontSize: 17.0f,
|
||||
letterSpacing: -0.41f,
|
||||
color: CupertinoColors.activeBlue,
|
||||
decoration: TextDecoration.none
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kDefaultTabLabelTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontSize: 10.0f,
|
||||
letterSpacing: -0.24f,
|
||||
color: CupertinoColors.inactiveGray
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kDefaultMiddleTitleTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Text",
|
||||
fontSize: 17.0f,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.41f,
|
||||
color: CupertinoColors.label
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kDefaultLargeTitleTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Display",
|
||||
fontSize: 34.0f,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.41f,
|
||||
color: CupertinoColors.label
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kDefaultPickerTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Display",
|
||||
fontSize: 21.0f,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: -0.41f,
|
||||
color: CupertinoColors.label
|
||||
);
|
||||
|
||||
public static readonly TextStyle _kDefaultDateTimePickerTextStyle = new TextStyle(
|
||||
inherit: false,
|
||||
fontFamily: ".SF Pro Display",
|
||||
fontSize: 21.0f,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: CupertinoColors.label
|
||||
);
|
||||
public static TextStyle _resolveTextStyle(TextStyle style, BuildContext context, bool nullOk) {
|
||||
return style?.copyWith(
|
||||
color: CupertinoDynamicColor.resolve(style?.color, context, nullOk: nullOk),
|
||||
backgroundColor: CupertinoDynamicColor.resolve(style?.backgroundColor, context, nullOk: nullOk),
|
||||
decorationColor: CupertinoDynamicColor.resolve(style?.decorationColor, context, nullOk: nullOk)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +155,9 @@ namespace Unity.UIWidgets.cupertino {
|
|||
TextStyle tabLabelTextStyle = null,
|
||||
TextStyle navTitleTextStyle = null,
|
||||
TextStyle navLargeTitleTextStyle = null,
|
||||
TextStyle navActionTextStyle = null
|
||||
TextStyle navActionTextStyle = null,
|
||||
TextStyle pickerTextStyle = null,
|
||||
TextStyle dateTimePickerTextStyle = null
|
||||
) {
|
||||
_primaryColor = primaryColor ?? CupertinoColors.activeBlue;
|
||||
_brightness = brightness;
|
||||
|
@ -98,22 +167,45 @@ namespace Unity.UIWidgets.cupertino {
|
|||
_navTitleTextStyle = navTitleTextStyle;
|
||||
_navLargeTitleTextStyle = navLargeTitleTextStyle;
|
||||
_navActionTextStyle = navActionTextStyle;
|
||||
_defaults = new _TextThemeDefaultsBuilder(CupertinoColors.label, CupertinoColors.inactiveGray);
|
||||
}
|
||||
public static CupertinoTextThemeData _raw(
|
||||
_TextThemeDefaultsBuilder _defaults,
|
||||
Color primaryColor ,
|
||||
TextStyle textStyle = null,
|
||||
TextStyle actionTextStyle = null,
|
||||
TextStyle tabLabelTextStyle = null,
|
||||
TextStyle navTitleTextStyle = null,
|
||||
TextStyle navLargeTitleTextStyle = null,
|
||||
TextStyle navActionTextStyle = null,
|
||||
TextStyle pickerTextStyle = null,
|
||||
TextStyle dateTimePickerTextStyle = null
|
||||
) {
|
||||
var textThemeData = new CupertinoTextThemeData(
|
||||
primaryColor,
|
||||
null,
|
||||
textStyle,
|
||||
actionTextStyle,
|
||||
tabLabelTextStyle,
|
||||
navTitleTextStyle,
|
||||
navLargeTitleTextStyle,
|
||||
navActionTextStyle,
|
||||
pickerTextStyle,
|
||||
dateTimePickerTextStyle
|
||||
);
|
||||
textThemeData._defaults = _defaults;
|
||||
return textThemeData;
|
||||
|
||||
}
|
||||
|
||||
_TextThemeDefaultsBuilder _defaults;
|
||||
readonly Color _primaryColor;
|
||||
readonly Brightness? _brightness;
|
||||
|
||||
bool _isLight {
|
||||
get { return _brightness != Brightness.dark; }
|
||||
}
|
||||
|
||||
readonly TextStyle _textStyle;
|
||||
|
||||
|
||||
readonly TextStyle _textStyle;
|
||||
public TextStyle textStyle {
|
||||
get {
|
||||
return _textStyle ?? (_isLight
|
||||
? CupertinoTextThemeDataUtils._kDefaultLightTextStyle
|
||||
: CupertinoTextThemeDataUtils._kDefaultDarkTextStyle);
|
||||
return _textStyle ?? _defaults.textStyle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,26 +213,23 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public TextStyle actionTextStyle {
|
||||
get {
|
||||
return _actionTextStyle ?? CupertinoTextThemeDataUtils._kDefaultActionTextStyle.copyWith(
|
||||
color: _primaryColor
|
||||
);
|
||||
return _actionTextStyle ?? _defaults.actionTextStyle(primaryColor: _primaryColor);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
readonly TextStyle _tabLabelTextStyle;
|
||||
|
||||
public TextStyle tabLabelTextStyle {
|
||||
get { return _tabLabelTextStyle ?? CupertinoTextThemeDataUtils._kDefaultTabLabelTextStyle; }
|
||||
get { return _tabLabelTextStyle ?? _defaults.tabLabelTextStyle;}
|
||||
}
|
||||
|
||||
readonly TextStyle _navTitleTextStyle;
|
||||
|
||||
public TextStyle navTitleTextStyle {
|
||||
get {
|
||||
return _navTitleTextStyle ??
|
||||
(_isLight
|
||||
? CupertinoTextThemeDataUtils._kDefaultMiddleTitleLightTextStyle
|
||||
: CupertinoTextThemeDataUtils._kDefaultMiddleTitleDarkTextStyle);
|
||||
return _navTitleTextStyle ?? _defaults.navTitleTextStyle;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,10 +238,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
/// Typography of large titles in sliver navigation bars.
|
||||
public TextStyle navLargeTitleTextStyle {
|
||||
get {
|
||||
return _navLargeTitleTextStyle ??
|
||||
(_isLight
|
||||
? CupertinoTextThemeDataUtils._kDefaultLargeTitleLightTextStyle
|
||||
: CupertinoTextThemeDataUtils._kDefaultLargeTitleDarkTextStyle);
|
||||
return _navLargeTitleTextStyle ?? _defaults.navLargeTitleTextStyle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,13 +246,42 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public TextStyle navActionTextStyle {
|
||||
get {
|
||||
return _navActionTextStyle ?? CupertinoTextThemeDataUtils._kDefaultActionTextStyle.copyWith(
|
||||
color: _primaryColor
|
||||
);
|
||||
return _navActionTextStyle ?? _defaults.navActionTextStyle(primaryColor: _primaryColor);
|
||||
}
|
||||
}
|
||||
readonly TextStyle _pickerTextStyle;
|
||||
|
||||
public TextStyle pickerTextStyle {
|
||||
get {
|
||||
return _pickerTextStyle ?? _defaults.pickerTextStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public CupertinoTextThemeData copyWith(
|
||||
readonly TextStyle _dateTimePickerTextStyle;
|
||||
|
||||
public TextStyle dateTimePickerTextStyle {
|
||||
get {
|
||||
return _dateTimePickerTextStyle ?? _defaults.dateTimePickerTextStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public CupertinoTextThemeData resolveFrom(BuildContext context, bool nullOk = false ) {
|
||||
return CupertinoTextThemeData._raw(
|
||||
_defaults?.resolveFrom(context, nullOk),
|
||||
CupertinoDynamicColor.resolve(_primaryColor, context, nullOk: nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_textStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_actionTextStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_tabLabelTextStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_navTitleTextStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_navLargeTitleTextStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_navActionTextStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_pickerTextStyle, context, nullOk),
|
||||
CupertinoTextThemeDataUtils._resolveTextStyle(_dateTimePickerTextStyle, context, nullOk)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public new CupertinoTextThemeData copyWith(
|
||||
Color primaryColor,
|
||||
Brightness? brightness,
|
||||
TextStyle textStyle,
|
||||
|
@ -174,7 +289,9 @@ namespace Unity.UIWidgets.cupertino {
|
|||
TextStyle tabLabelTextStyle,
|
||||
TextStyle navTitleTextStyle,
|
||||
TextStyle navLargeTitleTextStyle,
|
||||
TextStyle navActionTextStyle
|
||||
TextStyle navActionTextStyle,
|
||||
TextStyle pickerTextStyle,
|
||||
TextStyle dateTimePickerTextStyle
|
||||
) {
|
||||
return new CupertinoTextThemeData(
|
||||
primaryColor: primaryColor ?? _primaryColor,
|
||||
|
@ -184,8 +301,92 @@ namespace Unity.UIWidgets.cupertino {
|
|||
tabLabelTextStyle: tabLabelTextStyle ?? _tabLabelTextStyle,
|
||||
navTitleTextStyle: navTitleTextStyle ?? _navTitleTextStyle,
|
||||
navLargeTitleTextStyle: navLargeTitleTextStyle ?? _navLargeTitleTextStyle,
|
||||
navActionTextStyle: navActionTextStyle ?? _navActionTextStyle
|
||||
navActionTextStyle: navActionTextStyle ?? _navActionTextStyle,
|
||||
pickerTextStyle ?? _pickerTextStyle,
|
||||
dateTimePickerTextStyle ?? _dateTimePickerTextStyle
|
||||
);
|
||||
}
|
||||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
base.debugFillProperties(properties);
|
||||
CupertinoTextThemeData defaultData = new CupertinoTextThemeData();
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("textStyle", textStyle, defaultValue: defaultData.textStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("actionTextStyle", actionTextStyle, defaultValue: defaultData.actionTextStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("tabLabelTextStyle", tabLabelTextStyle, defaultValue: defaultData.tabLabelTextStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("navTitleTextStyle", navTitleTextStyle, defaultValue: defaultData.navTitleTextStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("navLargeTitleTextStyle", navLargeTitleTextStyle, defaultValue: defaultData.navLargeTitleTextStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("navActionTextStyle", navActionTextStyle, defaultValue: defaultData.navActionTextStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("pickerTextStyle", pickerTextStyle, defaultValue: defaultData.pickerTextStyle));
|
||||
properties.add(new DiagnosticsProperty<TextStyle>("dateTimePickerTextStyle", dateTimePickerTextStyle, defaultValue: defaultData.dateTimePickerTextStyle));
|
||||
}
|
||||
}
|
||||
public class _TextThemeDefaultsBuilder {
|
||||
public _TextThemeDefaultsBuilder(
|
||||
Color labelColor = null,
|
||||
Color inactiveGrayColor = null
|
||||
) {
|
||||
this.labelColor = labelColor;
|
||||
this.inactiveGrayColor = inactiveGrayColor;
|
||||
D.assert(labelColor != null);
|
||||
D.assert(inactiveGrayColor != null);
|
||||
}
|
||||
|
||||
public readonly Color labelColor;
|
||||
public readonly Color inactiveGrayColor;
|
||||
|
||||
public static TextStyle _applyLabelColor(TextStyle original, Color color) {
|
||||
return original?.color == color
|
||||
? original
|
||||
: original?.copyWith(color: color);
|
||||
}
|
||||
|
||||
public TextStyle textStyle {
|
||||
get {
|
||||
return _applyLabelColor(CupertinoTextThemeDataUtils._kDefaultTextStyle, labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
public TextStyle tabLabelTextStyle
|
||||
{
|
||||
get {
|
||||
return _applyLabelColor(CupertinoTextThemeDataUtils._kDefaultTabLabelTextStyle, inactiveGrayColor);
|
||||
}
|
||||
}
|
||||
|
||||
public TextStyle navTitleTextStyle {
|
||||
get {
|
||||
return _applyLabelColor(CupertinoTextThemeDataUtils._kDefaultMiddleTitleTextStyle, labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
public TextStyle navLargeTitleTextStyle {
|
||||
get {
|
||||
return _applyLabelColor(CupertinoTextThemeDataUtils._kDefaultLargeTitleTextStyle, labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
public TextStyle pickerTextStyle {
|
||||
get {
|
||||
return _applyLabelColor(CupertinoTextThemeDataUtils._kDefaultPickerTextStyle, labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
public TextStyle dateTimePickerTextStyle {
|
||||
get {
|
||||
return _applyLabelColor(CupertinoTextThemeDataUtils._kDefaultDateTimePickerTextStyle, labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TextStyle actionTextStyle( Color primaryColor = null) => CupertinoTextThemeDataUtils._kDefaultActionTextStyle.copyWith(color: primaryColor);
|
||||
public TextStyle navActionTextStyle( Color primaryColor = null) => actionTextStyle(primaryColor: primaryColor);
|
||||
|
||||
public _TextThemeDefaultsBuilder resolveFrom(BuildContext context, bool nullOk) {
|
||||
Color resolvedLabelColor = CupertinoDynamicColor.resolve(labelColor, context, nullOk: nullOk);
|
||||
Color resolvedInactiveGray = CupertinoDynamicColor.resolve(inactiveGrayColor, context, nullOk: nullOk);
|
||||
return resolvedLabelColor == labelColor && resolvedInactiveGray == CupertinoColors.inactiveGray
|
||||
? this
|
||||
: new _TextThemeDefaultsBuilder(resolvedLabelColor, resolvedInactiveGray);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +1,34 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.service;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using Brightness = Unity.UIWidgets.ui.Brightness;
|
||||
using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
||||
|
||||
namespace Unity.UIWidgets.cupertino {
|
||||
static class CupertinoThemeDataUtils {
|
||||
public static readonly Color _kDefaultBarLightBackgroundColor = new Color(0xCCF8F8F8);
|
||||
public static readonly Color _kDefaultBarDarkBackgroundColor = new Color(0xB7212121);
|
||||
public static readonly _CupertinoThemeDefaults _kDefaultTheme = new _CupertinoThemeDefaults(
|
||||
null,
|
||||
CupertinoColors.systemBlue,
|
||||
CupertinoColors.systemBackground,
|
||||
CupertinoDynamicColor.withBrightness(
|
||||
debugLabel : "",
|
||||
color: new Color(0xF0F9F9F9),
|
||||
darkColor: new Color(0xF01D1D1D)
|
||||
),
|
||||
CupertinoColors.systemBackground,
|
||||
new _CupertinoTextThemeDefaults(CupertinoColors.label, CupertinoColors.inactiveGray)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public class CupertinoTheme : StatelessWidget {
|
||||
public CupertinoTheme(
|
||||
CupertinoThemeData data,
|
||||
Widget child,
|
||||
CupertinoThemeData data = null,
|
||||
Widget child = null,
|
||||
Key key = null
|
||||
) : base(key: key) {
|
||||
D.assert(child != null);
|
||||
|
@ -28,29 +43,41 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public static CupertinoThemeData of(BuildContext context) {
|
||||
_InheritedCupertinoTheme inheritedTheme =
|
||||
(_InheritedCupertinoTheme) context.inheritFromWidgetOfExactType(typeof(_InheritedCupertinoTheme));
|
||||
(_InheritedCupertinoTheme) context.dependOnInheritedWidgetOfExactType<_InheritedCupertinoTheme>(null);
|
||||
//context.inheritFromWidgetOfExactType(typeof(_InheritedCupertinoTheme));
|
||||
return inheritedTheme?.theme?.data ?? new CupertinoThemeData();
|
||||
}
|
||||
|
||||
public static Brightness? brightnessOf(BuildContext context, bool nullOk = false) {
|
||||
_InheritedCupertinoTheme inheritedTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<_InheritedCupertinoTheme>(null);
|
||||
var brightness = inheritedTheme?.theme?.data?.brightness;
|
||||
var platformBrightness = MediaQuery.of(context, nullOk: nullOk)?.platformBrightness;
|
||||
return brightness ?? platformBrightness;
|
||||
}
|
||||
|
||||
public override Widget build(BuildContext context) {
|
||||
return new _InheritedCupertinoTheme(
|
||||
theme: this,
|
||||
child: new IconTheme(
|
||||
data: new IconThemeData(color: data.primaryColor),
|
||||
data: new CupertinoIconThemeData(color: data.primaryColor),
|
||||
child: child
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
base.debugFillProperties(properties);
|
||||
data.debugFillProperties(properties);
|
||||
}
|
||||
}
|
||||
|
||||
class _InheritedCupertinoTheme : InheritedWidget {
|
||||
public _InheritedCupertinoTheme(
|
||||
CupertinoTheme theme,
|
||||
Widget child,
|
||||
Key key = null
|
||||
)
|
||||
: base(key: key, child: child) {
|
||||
Key key = null,
|
||||
CupertinoTheme theme = null,
|
||||
Widget child = null
|
||||
) : base(key: key, child: child) {
|
||||
D.assert(theme != null);
|
||||
this.theme = theme;
|
||||
}
|
||||
|
@ -71,23 +98,25 @@ namespace Unity.UIWidgets.cupertino {
|
|||
Color barBackgroundColor = null,
|
||||
Color scaffoldBackgroundColor = null
|
||||
) {
|
||||
_brightness = brightness;
|
||||
this.brightness = brightness;// ?? Brightness.light;
|
||||
_primaryColor = primaryColor;
|
||||
_primaryContrastingColor = primaryContrastingColor;
|
||||
_textTheme = textTheme;
|
||||
_barBackgroundColor = barBackgroundColor;
|
||||
_scaffoldBackgroundColor = scaffoldBackgroundColor;
|
||||
_defaults = CupertinoThemeDataUtils._kDefaultTheme;
|
||||
|
||||
}
|
||||
|
||||
public static CupertinoThemeData raw(
|
||||
Brightness? brightness = null,
|
||||
Color primaryColor = null,
|
||||
Color primaryContrastingColor = null,
|
||||
CupertinoTextThemeData textTheme = null,
|
||||
Color barBackgroundColor = null,
|
||||
Color scaffoldBackgroundColor = null
|
||||
/*public static CupertinoThemeData raw(
|
||||
Brightness brightness ,
|
||||
Color primaryColor ,
|
||||
Color primaryContrastingColor ,
|
||||
CupertinoTextThemeData textTheme,
|
||||
Color barBackgroundColor ,
|
||||
Color scaffoldBackgroundColor
|
||||
) {
|
||||
D.assert(brightness != null);
|
||||
/* D.assert(brightness != null);
|
||||
D.assert(primaryColor != null);
|
||||
D.assert(primaryContrastingColor != null);
|
||||
D.assert(textTheme != null);
|
||||
|
@ -100,23 +129,46 @@ namespace Unity.UIWidgets.cupertino {
|
|||
textTheme: textTheme,
|
||||
barBackgroundColor: barBackgroundColor,
|
||||
scaffoldBackgroundColor: scaffoldBackgroundColor
|
||||
);
|
||||
);*/
|
||||
/*return _rawWithDefaults(
|
||||
brightness,
|
||||
primaryColor,
|
||||
primaryContrastingColor,
|
||||
textTheme,
|
||||
barBackgroundColor,
|
||||
scaffoldBackgroundColor,
|
||||
_kDefaultTheme
|
||||
);
|
||||
}*/
|
||||
|
||||
public static CupertinoThemeData _rawWithDefaults(
|
||||
Brightness? brightness,
|
||||
Color primaryColor,
|
||||
Color primaryContrastingColor ,
|
||||
CupertinoTextThemeData textTheme ,
|
||||
Color barBackgroundColor ,
|
||||
Color scaffoldBackgroundColor ,
|
||||
_CupertinoThemeDefaults defaults
|
||||
) {
|
||||
var themeData = new CupertinoThemeData(
|
||||
brightness: brightness,
|
||||
primaryColor: primaryColor,
|
||||
primaryContrastingColor: primaryContrastingColor,
|
||||
textTheme: textTheme,
|
||||
barBackgroundColor: barBackgroundColor,
|
||||
scaffoldBackgroundColor: scaffoldBackgroundColor);
|
||||
themeData._defaults = defaults;
|
||||
return themeData;
|
||||
}
|
||||
|
||||
bool _isLight {
|
||||
get { return brightness == Brightness.light; }
|
||||
}
|
||||
public _CupertinoThemeDefaults _defaults;
|
||||
|
||||
public Brightness brightness {
|
||||
get { return _brightness ?? Brightness.light; }
|
||||
}
|
||||
|
||||
readonly Brightness? _brightness;
|
||||
public readonly Brightness? brightness;
|
||||
|
||||
public Color primaryColor {
|
||||
get {
|
||||
return _primaryColor ??
|
||||
(_isLight ? CupertinoColors.activeBlue : CupertinoColors.activeOrange);
|
||||
return _primaryColor ?? _defaults.primaryColor;
|
||||
//(_isLight ? CupertinoColors.activeBlue : CupertinoColors.activeOrange);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,8 +176,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public Color primaryContrastingColor {
|
||||
get {
|
||||
return _primaryContrastingColor ??
|
||||
(_isLight ? CupertinoColors.white : CupertinoColors.black);
|
||||
return _primaryContrastingColor ?? _defaults.primaryContrastingColor;
|
||||
//(_isLight ? CupertinoColors.white : CupertinoColors.black);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,10 +185,11 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public CupertinoTextThemeData textTheme {
|
||||
get {
|
||||
return _textTheme ?? new CupertinoTextThemeData(
|
||||
return _textTheme ?? _defaults.textThemeDefaults.createDefaults(primaryColor: primaryColor);
|
||||
/*new CupertinoTextThemeData(
|
||||
brightness: brightness,
|
||||
primaryColor: primaryColor
|
||||
);
|
||||
);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,10 +197,10 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public Color barBackgroundColor {
|
||||
get {
|
||||
return _barBackgroundColor ??
|
||||
(_isLight
|
||||
return _barBackgroundColor ?? _defaults.barBackgroundColor;
|
||||
/*(_isLight
|
||||
? CupertinoThemeDataUtils._kDefaultBarLightBackgroundColor
|
||||
: CupertinoThemeDataUtils._kDefaultBarDarkBackgroundColor);
|
||||
: CupertinoThemeDataUtils._kDefaultBarDarkBackgroundColor);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,8 +208,8 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public Color scaffoldBackgroundColor {
|
||||
get {
|
||||
return _scaffoldBackgroundColor ??
|
||||
(_isLight ? CupertinoColors.white : CupertinoColors.black);
|
||||
return _scaffoldBackgroundColor ?? _defaults.scaffoldBackgroundColor;
|
||||
// (_isLight ? CupertinoColors.white : CupertinoColors.black);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +217,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
|
||||
public CupertinoThemeData noDefault() {
|
||||
return new _NoDefaultCupertinoThemeData(
|
||||
_brightness,
|
||||
brightness,
|
||||
_primaryColor,
|
||||
_primaryContrastingColor,
|
||||
_textTheme,
|
||||
|
@ -173,6 +226,19 @@ namespace Unity.UIWidgets.cupertino {
|
|||
);
|
||||
}
|
||||
|
||||
protected CupertinoThemeData resolveFrom(BuildContext context, bool nullOk = false ) {
|
||||
Color convertColor(Color color) => CupertinoDynamicColor.resolve(color, context, nullOk: nullOk);
|
||||
|
||||
return CupertinoThemeData._rawWithDefaults(
|
||||
brightness,
|
||||
convertColor(_primaryColor),
|
||||
convertColor(_primaryContrastingColor),
|
||||
_textTheme?.resolveFrom(context, nullOk: nullOk),
|
||||
convertColor(_barBackgroundColor),
|
||||
convertColor(_scaffoldBackgroundColor),
|
||||
_defaults.resolveFrom(context, _textTheme == null, nullOk: nullOk)
|
||||
);
|
||||
}
|
||||
public CupertinoThemeData copyWith(
|
||||
Brightness? brightness = null,
|
||||
Color primaryColor = null,
|
||||
|
@ -181,13 +247,15 @@ namespace Unity.UIWidgets.cupertino {
|
|||
Color barBackgroundColor = null,
|
||||
Color scaffoldBackgroundColor = null
|
||||
) {
|
||||
return new CupertinoThemeData(
|
||||
brightness: brightness ?? _brightness,
|
||||
//return new CupertinoThemeData(
|
||||
return CupertinoThemeData._rawWithDefaults(
|
||||
brightness: brightness ?? this.brightness,
|
||||
primaryColor: primaryColor ?? _primaryColor,
|
||||
primaryContrastingColor: primaryContrastingColor ?? _primaryContrastingColor,
|
||||
textTheme: textTheme ?? _textTheme,
|
||||
barBackgroundColor: barBackgroundColor ?? _barBackgroundColor,
|
||||
scaffoldBackgroundColor: scaffoldBackgroundColor ?? _scaffoldBackgroundColor
|
||||
scaffoldBackgroundColor: scaffoldBackgroundColor ?? _scaffoldBackgroundColor,
|
||||
_defaults
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -195,7 +263,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
base.debugFillProperties(properties);
|
||||
CupertinoThemeData defaultData = new CupertinoThemeData();
|
||||
properties.add(
|
||||
new EnumProperty<Brightness>("brightness", brightness, defaultValue: defaultData.brightness));
|
||||
new EnumProperty<Brightness?>("brightness", brightness, defaultValue: defaultData.brightness));
|
||||
properties.add(new DiagnosticsProperty<Color>("primaryColor", primaryColor,
|
||||
defaultValue: defaultData.primaryColor));
|
||||
properties.add(new DiagnosticsProperty<Color>("primaryContrastingColor", primaryContrastingColor,
|
||||
|
@ -207,6 +275,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
defaultValue: defaultData.barBackgroundColor));
|
||||
properties.add(new DiagnosticsProperty<Color>("scaffoldBackgroundColor", scaffoldBackgroundColor,
|
||||
defaultValue: defaultData.scaffoldBackgroundColor));
|
||||
textTheme.debugFillProperties(properties);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,6 +294,7 @@ namespace Unity.UIWidgets.cupertino {
|
|||
this.textTheme = textTheme;
|
||||
this.barBackgroundColor = barBackgroundColor;
|
||||
this.scaffoldBackgroundColor = scaffoldBackgroundColor;
|
||||
_defaults = null;
|
||||
}
|
||||
|
||||
public new readonly Brightness? brightness;
|
||||
|
@ -238,5 +308,169 @@ namespace Unity.UIWidgets.cupertino {
|
|||
public new readonly Color barBackgroundColor;
|
||||
|
||||
public new readonly Color scaffoldBackgroundColor;
|
||||
|
||||
public new _NoDefaultCupertinoThemeData resolveFrom(BuildContext context,bool nullOk = false ) {
|
||||
Color convertColor(Color color) => CupertinoDynamicColor.resolve(color, context, nullOk: nullOk);
|
||||
|
||||
return new _NoDefaultCupertinoThemeData(
|
||||
brightness,
|
||||
convertColor(primaryColor),
|
||||
convertColor(primaryContrastingColor),
|
||||
textTheme?.resolveFrom(context, nullOk: nullOk),
|
||||
convertColor(barBackgroundColor),
|
||||
convertColor(scaffoldBackgroundColor)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public new CupertinoThemeData copyWith(
|
||||
Brightness? brightness = null,
|
||||
Color primaryColor = null,
|
||||
Color primaryContrastingColor = null,
|
||||
CupertinoTextThemeData textTheme = null,
|
||||
Color barBackgroundColor = null,
|
||||
Color scaffoldBackgroundColor = null
|
||||
) {
|
||||
return new _NoDefaultCupertinoThemeData(
|
||||
brightness ?? this.brightness,
|
||||
primaryColor ?? this.primaryColor,
|
||||
primaryContrastingColor ?? this.primaryContrastingColor,
|
||||
textTheme ?? this.textTheme,
|
||||
barBackgroundColor ?? this.barBackgroundColor,
|
||||
scaffoldBackgroundColor ?? this.scaffoldBackgroundColor
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public class _CupertinoThemeDefaults {
|
||||
public _CupertinoThemeDefaults(
|
||||
Brightness? brightness = null,
|
||||
Color primaryColor = null,
|
||||
Color primaryContrastingColor = null,
|
||||
Color barBackgroundColor = null,
|
||||
Color scaffoldBackgroundColor = null,
|
||||
_CupertinoTextThemeDefaults textThemeDefaults = null
|
||||
)
|
||||
{
|
||||
this.brightness = brightness;
|
||||
this.primaryColor = primaryColor;
|
||||
this.primaryContrastingColor = primaryContrastingColor;
|
||||
this.barBackgroundColor = barBackgroundColor;
|
||||
this.scaffoldBackgroundColor = scaffoldBackgroundColor;
|
||||
this.textThemeDefaults = textThemeDefaults;
|
||||
|
||||
}
|
||||
public Brightness? brightness;
|
||||
public Color primaryColor;
|
||||
public Color primaryContrastingColor;
|
||||
public Color barBackgroundColor;
|
||||
public Color scaffoldBackgroundColor;
|
||||
public _CupertinoTextThemeDefaults textThemeDefaults;
|
||||
|
||||
public _CupertinoThemeDefaults resolveFrom(BuildContext context, bool resolveTextTheme, bool nullOk = false) {
|
||||
D.assert(nullOk != null);
|
||||
Color convertColor(Color color) => CupertinoDynamicColor.resolve(color, context, nullOk: nullOk);
|
||||
|
||||
return new _CupertinoThemeDefaults(
|
||||
brightness,
|
||||
convertColor(primaryColor),
|
||||
convertColor(primaryContrastingColor),
|
||||
convertColor(barBackgroundColor),
|
||||
convertColor(scaffoldBackgroundColor),
|
||||
resolveTextTheme ? textThemeDefaults?.resolveFrom(context, nullOk: nullOk) : textThemeDefaults
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class _CupertinoTextThemeDefaults {
|
||||
public _CupertinoTextThemeDefaults(
|
||||
Color labelColor = null,
|
||||
Color inactiveGray = null
|
||||
) {
|
||||
this.labelColor = labelColor;
|
||||
this.inactiveGray = inactiveGray;
|
||||
}
|
||||
|
||||
public readonly Color labelColor;
|
||||
public readonly Color inactiveGray;
|
||||
|
||||
public _CupertinoTextThemeDefaults resolveFrom(BuildContext context, bool nullOk = false) {
|
||||
return new _CupertinoTextThemeDefaults(
|
||||
CupertinoDynamicColor.resolve(labelColor, context, nullOk: nullOk),
|
||||
CupertinoDynamicColor.resolve(inactiveGray, context, nullOk: nullOk)
|
||||
);
|
||||
}
|
||||
|
||||
public CupertinoTextThemeData createDefaults(Color primaryColor = null) {
|
||||
D.assert(primaryColor != null);
|
||||
return new _DefaultCupertinoTextThemeData(
|
||||
primaryColor: primaryColor,
|
||||
labelColor: labelColor,
|
||||
inactiveGray: inactiveGray
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DefaultCupertinoTextThemeData : CupertinoTextThemeData {
|
||||
public _DefaultCupertinoTextThemeData(
|
||||
Color labelColor = null,
|
||||
Color inactiveGray = null,
|
||||
Color primaryColor = null
|
||||
) : base(primaryColor: primaryColor) {
|
||||
D.assert(labelColor != null);
|
||||
D.assert(inactiveGray != null);
|
||||
D.assert(primaryColor != null);
|
||||
this.labelColor = labelColor;
|
||||
this.inactiveGray = inactiveGray;
|
||||
|
||||
}
|
||||
|
||||
public readonly Color labelColor;
|
||||
public readonly Color inactiveGray;
|
||||
|
||||
|
||||
public new TextStyle textStyle {
|
||||
get {
|
||||
return base.textStyle.copyWith(color: labelColor);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public new TextStyle tabLabelTextStyle {
|
||||
get {
|
||||
return base.tabLabelTextStyle.copyWith(color: inactiveGray);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public new TextStyle navTitleTextStyle {
|
||||
get {
|
||||
return base.navTitleTextStyle.copyWith(color: labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public new TextStyle navLargeTitleTextStyle {
|
||||
get {
|
||||
return base.navLargeTitleTextStyle.copyWith(color: labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public new TextStyle pickerTextStyle {
|
||||
get {
|
||||
return base.pickerTextStyle.copyWith(color: labelColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public new TextStyle dateTimePickerTextStyle {
|
||||
get {
|
||||
return base.dateTimePickerTextStyle.copyWith(color: labelColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -258,10 +258,24 @@ namespace Unity.UIWidgets.ui{
|
|||
}
|
||||
|
||||
public static Offset operator -(Offset a, Offset b) {
|
||||
if (a == null) {
|
||||
return new Offset(-b.dx, -b.dy);
|
||||
|
||||
}
|
||||
else if (b == null) {
|
||||
return new Offset(-a.dx, -a.dy);
|
||||
}
|
||||
return new Offset(a.dx - b.dx, a.dy - b.dy);
|
||||
}
|
||||
|
||||
public static Offset operator +(Offset a, Offset b) {
|
||||
if (a == null) {
|
||||
return b;
|
||||
}
|
||||
else if (b == null) {
|
||||
return a;
|
||||
}
|
||||
|
||||
return new Offset(a.dx + b.dx, a.dy + b.dy);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace Unity.UIWidgets.widgets {
|
|||
public delegate string GenerateAppTitle(BuildContext context);
|
||||
|
||||
public delegate PageRoute PageRouteFactory(RouteSettings settings, WidgetBuilder builder);
|
||||
|
||||
public delegate List<Route> InitialRouteListFactory(string initialRoute);
|
||||
|
||||
public class WidgetsApp : StatefulWidget {
|
||||
public readonly TransitionBuilder builder;
|
||||
|
@ -26,6 +28,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
public readonly GlobalKey<NavigatorState> navigatorKey;
|
||||
public readonly List<NavigatorObserver> navigatorObservers;
|
||||
public readonly RouteFactory onGenerateRoute;
|
||||
public readonly InitialRouteListFactory onGenerateInitialRoutes;
|
||||
public readonly RouteFactory onUnknownRoute;
|
||||
public readonly PageRouteFactory pageRouteBuilder;
|
||||
public readonly Dictionary<string, WidgetBuilder> routes;
|
||||
|
@ -47,6 +50,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
Key key = null,
|
||||
GlobalKey<NavigatorState> navigatorKey = null,
|
||||
RouteFactory onGenerateRoute = null,
|
||||
InitialRouteListFactory onGenerateInitialRoutes = null,
|
||||
RouteFactory onUnknownRoute = null,
|
||||
PageRouteFactory pageRouteBuilder = null,
|
||||
List<NavigatorObserver> navigatorObservers = null,
|
||||
|
@ -72,6 +76,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
this.home = home;
|
||||
this.navigatorKey = navigatorKey;
|
||||
this.onGenerateRoute = onGenerateRoute;
|
||||
this.onGenerateInitialRoutes = onGenerateInitialRoutes;
|
||||
this.onUnknownRoute = onUnknownRoute;
|
||||
this.pageRouteBuilder = pageRouteBuilder;
|
||||
this.routes = routes;
|
||||
|
@ -90,7 +95,12 @@ namespace Unity.UIWidgets.widgets {
|
|||
this.title = title;
|
||||
this.color = color;
|
||||
this.inspectorSelectButtonBuilder = inspectorSelectButtonBuilder;
|
||||
|
||||
|
||||
D.assert(
|
||||
home == null ||
|
||||
onGenerateInitialRoutes == null,
|
||||
() => "If onGenerateInitialRoutes is specifiied, the home argument will be redundant."
|
||||
);
|
||||
D.assert(
|
||||
home == null ||
|
||||
!this.routes.ContainsKey(Navigator.defaultRouteName),
|
||||
|
@ -166,13 +176,13 @@ namespace Unity.UIWidgets.widgets {
|
|||
GlobalKey<NavigatorState> _navigator;
|
||||
|
||||
public Future<bool> didPopRoute() {
|
||||
///async
|
||||
D.assert(mounted);
|
||||
var navigator = _navigator?.currentState;
|
||||
if (navigator == null) {
|
||||
return Future<bool>.value(false).to<bool>();
|
||||
}
|
||||
|
||||
return navigator.maybePop();
|
||||
return navigator.maybePop<bool>();
|
||||
}
|
||||
|
||||
public Future<bool> didPushRoute(string route) {
|
||||
|
@ -182,7 +192,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
return Future<bool>.value(false).to<bool>();
|
||||
}
|
||||
|
||||
navigator.pushNamed(route);
|
||||
navigator.pushNamed<bool>(route);
|
||||
return Future<bool>.value(true).to<bool>();
|
||||
}
|
||||
|
||||
|
@ -398,8 +408,18 @@ namespace Unity.UIWidgets.widgets {
|
|||
if (_navigator != null) {
|
||||
navigator = new Navigator(
|
||||
key: _navigator,
|
||||
initialRoute: widget.initialRoute ?? Navigator.defaultRouteName,
|
||||
//initialRoute: widget.initialRoute ?? Navigator.defaultRouteName,
|
||||
//onGenerateRoute: _onGenerateRoute,
|
||||
initialRoute: WidgetsBinding.instance.window.defaultRouteName != Navigator.defaultRouteName
|
||||
? WidgetsBinding.instance.window.defaultRouteName
|
||||
: widget.initialRoute ?? WidgetsBinding.instance.window.defaultRouteName,
|
||||
onGenerateRoute: _onGenerateRoute,
|
||||
onGenerateInitialRoutes:
|
||||
widget.onGenerateInitialRoutes == null
|
||||
? Navigator.defaultGenerateInitialRoutes
|
||||
: (NavigatorState navigator1, string initialRouteName) => {
|
||||
return widget.onGenerateInitialRoutes(initialRouteName);
|
||||
},
|
||||
onUnknownRoute: _onUnknownRoute,
|
||||
observers: widget.navigatorObservers
|
||||
);
|
||||
|
|
|
@ -93,7 +93,8 @@ namespace Unity.UIWidgets.widgets {
|
|||
}
|
||||
|
||||
void _updateParentDataOfChild(ParentDataElement childElement) {
|
||||
childElement.applyWidgetOutOfTurn((ParentDataWidget<SliverWithKeepAliveWidget>) build(context));
|
||||
//childElement.applyWidgetOutOfTurn((ParentDataWidget<SliverWithKeepAliveWidget>) build(context));
|
||||
childElement.applyWidgetOutOfTurn((ParentDataWidget)build(context));
|
||||
}
|
||||
|
||||
VoidCallback _createCallback(Listenable handle) {
|
||||
|
|
|
@ -177,7 +177,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
int itemIndex,
|
||||
TimeSpan duration,
|
||||
Curve curve
|
||||
) {
|
||||
) {///////
|
||||
if (!hasClients) {
|
||||
return null;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -14,7 +14,6 @@ namespace Unity.UIWidgets.widgets {
|
|||
RouteSettings settings = null
|
||||
) : base(settings) {
|
||||
}
|
||||
|
||||
public override List<OverlayEntry> overlayEntries {
|
||||
get { return _overlayEntries; }
|
||||
}
|
||||
|
@ -376,23 +375,24 @@ namespace Unity.UIWidgets.widgets {
|
|||
}
|
||||
}
|
||||
|
||||
public class _ModalScope : StatefulWidget {
|
||||
public _ModalScope(Key key = null, ModalRoute route = null) : base(key) {
|
||||
public class _ModalScope<T> : StatefulWidget {
|
||||
public _ModalScope(Key key = null, ModalRoute<T> route = null) : base(key) {
|
||||
this.route = route;
|
||||
}
|
||||
|
||||
public readonly ModalRoute route;
|
||||
public readonly ModalRoute<T> route;
|
||||
|
||||
public override State createState() {
|
||||
return new _ModalScopeState();
|
||||
return new _ModalScopeState<T>();
|
||||
}
|
||||
}
|
||||
|
||||
public class _ModalScopeState : State<_ModalScope> {
|
||||
public class _ModalScopeState<T> : State<_ModalScope<T>> {
|
||||
Widget _page;
|
||||
|
||||
Listenable _listenable;
|
||||
|
||||
//public readonly FocusScopeNode focusScopeNode = new FocusScopeNode(debugLabel: "$_ModalScopeState Focus Scope");
|
||||
public override void initState() {
|
||||
base.initState();
|
||||
var animations = new List<Listenable> { };
|
||||
|
@ -409,7 +409,10 @@ namespace Unity.UIWidgets.widgets {
|
|||
|
||||
public override void didUpdateWidget(StatefulWidget oldWidget) {
|
||||
base.didUpdateWidget(oldWidget);
|
||||
D.assert(widget.route == ((_ModalScope) oldWidget).route);
|
||||
D.assert(widget.route == ((_ModalScope<T>) oldWidget).route);
|
||||
/*if (widget.route.isCurrent) {
|
||||
widget.route.navigator.focusScopeNode.setFirstFocus(focusScopeNode);
|
||||
}*/
|
||||
}
|
||||
|
||||
public override void didChangeDependencies() {
|
||||
|
@ -470,7 +473,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
}
|
||||
}
|
||||
|
||||
public abstract class ModalRoute : LocalHistoryRouteTransitionRoute {
|
||||
public abstract class ModalRoute<T> : LocalHistoryRouteTransitionRoute {
|
||||
protected ModalRoute() {
|
||||
}
|
||||
|
||||
|
@ -479,10 +482,10 @@ namespace Unity.UIWidgets.widgets {
|
|||
|
||||
public static Color _kTransparent = new Color(0x00000000);
|
||||
|
||||
public static ModalRoute of(BuildContext context) {
|
||||
public static ModalRoute<T> of(BuildContext context) {
|
||||
_ModalScopeStatus widget =
|
||||
(_ModalScopeStatus) context.inheritFromWidgetOfExactType(typeof(_ModalScopeStatus));
|
||||
return (ModalRoute) widget?.route;
|
||||
return (ModalRoute<T>) widget?.route;
|
||||
}
|
||||
|
||||
protected virtual void setState(VoidCallback fn) {
|
||||
|
@ -571,7 +574,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
readonly List<WillPopCallback> _willPopCallbacks = new List<WillPopCallback>();
|
||||
|
||||
public override Future<RoutePopDisposition> willPop() {
|
||||
_ModalScopeState scope = _scopeKey.currentState;
|
||||
_ModalScopeState<T> scope = _scopeKey.currentState as _ModalScopeState<T> ;
|
||||
D.assert(scope != null);
|
||||
|
||||
bool result = false;
|
||||
|
@ -642,8 +645,8 @@ namespace Unity.UIWidgets.widgets {
|
|||
}
|
||||
|
||||
|
||||
readonly GlobalKey<_ModalScopeState> _scopeKey = new LabeledGlobalKey<_ModalScopeState>();
|
||||
internal readonly GlobalKey _subtreeKey = new LabeledGlobalKey<_ModalScopeState>();
|
||||
readonly GlobalKey<_ModalScopeState<T>> _scopeKey = new LabeledGlobalKey<_ModalScopeState<T>>();
|
||||
internal readonly GlobalKey _subtreeKey = new LabeledGlobalKey<T>();
|
||||
internal readonly PageStorageBucket _storageBucket = new PageStorageBucket();
|
||||
|
||||
static readonly Animatable<float> _easeCurveTween = new CurveTween(curve: Curves.ease);
|
||||
|
@ -680,7 +683,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
Widget _modalScopeCache;
|
||||
|
||||
Widget _buildModalScope(BuildContext context) {
|
||||
return _modalScopeCache = _modalScopeCache ?? new _ModalScope(
|
||||
return _modalScopeCache = _modalScopeCache ?? new _ModalScope<T>(
|
||||
key: _scopeKey,
|
||||
route: this
|
||||
// _ModalScope calls buildTransitions() and buildChild(), defined above
|
||||
|
@ -700,7 +703,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
}
|
||||
}
|
||||
|
||||
public abstract class PopupRoute : ModalRoute {
|
||||
public abstract class PopupRoute<T> : ModalRoute<T> {
|
||||
protected PopupRoute(
|
||||
RouteSettings settings = null
|
||||
) : base(settings: settings) {
|
||||
|
@ -778,7 +781,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
void didPushNext();
|
||||
}
|
||||
|
||||
class _DialogRoute : PopupRoute {
|
||||
class _DialogRoute<T> : PopupRoute<T> {
|
||||
internal _DialogRoute(RoutePageBuilder pageBuilder = null, bool barrierDismissible = true,
|
||||
Color barrierColor = null,
|
||||
TimeSpan? transitionDuration = null,
|
||||
|
@ -822,7 +825,7 @@ namespace Unity.UIWidgets.widgets {
|
|||
}
|
||||
|
||||
public static class DialogUtils {
|
||||
public static Future<object> showGeneralDialog(
|
||||
public static Future<T> showGeneralDialog<T>(
|
||||
BuildContext context = null,
|
||||
RoutePageBuilder pageBuilder = null,
|
||||
bool barrierDismissible = false,
|
||||
|
@ -831,13 +834,13 @@ namespace Unity.UIWidgets.widgets {
|
|||
RouteTransitionsBuilder transitionBuilder = null
|
||||
) {
|
||||
D.assert(pageBuilder != null);
|
||||
return Navigator.of(context, rootNavigator: true).push(new _DialogRoute(
|
||||
return Navigator.of(context, rootNavigator: true).push<T>(new _DialogRoute(
|
||||
pageBuilder: pageBuilder,
|
||||
barrierDismissible: barrierDismissible,
|
||||
barrierColor: barrierColor,
|
||||
transitionDuration: transitionDuration,
|
||||
transitionBuilder: transitionBuilder
|
||||
)).to<object>();
|
||||
)); //.to<object>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче