iizzaya
5 年前
当前提交
0cb4fb39
共有 24 个文件被更改,包括 3215 次插入 和 18 次删除
-
4Runtime/foundation/basic_types.cs
-
59Runtime/widgets/app.cs
-
4Runtime/widgets/heroes.cs
-
2Runtime/widgets/pages.cs
-
8Runtime/cupertino.meta
-
1001Tests/Resources/CupertinoIcons.ttf
-
22Tests/Resources/CupertinoIcons.ttf.meta
-
205Runtime/cupertino/app.cs
-
11Runtime/cupertino/app.cs.meta
-
243Runtime/cupertino/button.cs
-
11Runtime/cupertino/button.cs.meta
-
25Runtime/cupertino/colors.cs
-
11Runtime/cupertino/colors.cs.meta
-
142Runtime/cupertino/icons.cs
-
11Runtime/cupertino/icons.cs.meta
-
242Runtime/cupertino/localization.cs
-
11Runtime/cupertino/localization.cs.meta
-
757Runtime/cupertino/route.cs
-
11Runtime/cupertino/route.cs.meta
-
190Runtime/cupertino/text_theme.cs
-
11Runtime/cupertino/text_theme.cs.meta
-
241Runtime/cupertino/theme.cs
-
11Runtime/cupertino/theme.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 30914a0a38eca48bfa7c425f084a3684 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Tests/Resources/CupertinoIcons.ttf
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 06748fb439a2a4c1aa38914b8698f547 |
|||
TrueTypeFontImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 4 |
|||
fontSize: 16 |
|||
forceTextureCase: -2 |
|||
characterSpacing: 0 |
|||
characterPadding: 1 |
|||
includeFontData: 1 |
|||
fontName: CupertinoIcons |
|||
fontNames: |
|||
- CupertinoIcons |
|||
fallbackFontReferences: [] |
|||
customCharacters: |
|||
fontRenderingMode: 0 |
|||
ascentCalculationMode: 1 |
|||
useLegacyBoundsCalculation: 0 |
|||
shouldRoundAdvanceValue: 1 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
public class CupertinoApp : StatefulWidget { |
|||
public CupertinoApp( |
|||
Key key = null, |
|||
GlobalKey<NavigatorState> navigatorKey = null, |
|||
Widget home = null, |
|||
CupertinoThemeData theme = null, |
|||
Dictionary<string, WidgetBuilder> routes = null, |
|||
string initialRoute = null, |
|||
RouteFactory onGenerateRoute = null, |
|||
RouteFactory onUnknownRoute = null, |
|||
List<NavigatorObserver> navigatorObservers = null, |
|||
TransitionBuilder builder = null, |
|||
string title = "", |
|||
GenerateAppTitle onGenerateTitle = null, |
|||
Color color = null, |
|||
Locale locale = null, |
|||
List<LocalizationsDelegate<CupertinoLocalizations>> localizationsDelegates = null, |
|||
LocaleListResolutionCallback localeListResolutionCallback = null, |
|||
LocaleResolutionCallback localeResolutionCallback = null, |
|||
List<Locale> supportedLocales = null, |
|||
bool showPerformanceOverlay = false, |
|||
bool checkerboardRasterCacheImages = false, |
|||
bool checkerboardOffscreenLayers = false, |
|||
bool showSemanticsDebugger = false, |
|||
bool debugShowCheckedModeBanner = true |
|||
) : 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; |
|||
this.home = home; |
|||
this.theme = theme; |
|||
this.routes = routes ?? new Dictionary<string, WidgetBuilder>(); |
|||
this.initialRoute = initialRoute; |
|||
this.onGenerateRoute = onGenerateRoute; |
|||
this.onUnknownRoute = onUnknownRoute; |
|||
this.navigatorObservers = navigatorObservers ?? new List<NavigatorObserver>(); |
|||
this.builder = builder; |
|||
this.title = title; |
|||
this.onGenerateTitle = onGenerateTitle; |
|||
this.color = color; |
|||
this.locale = locale; |
|||
this.localizationsDelegates = localizationsDelegates; |
|||
this.localeListResolutionCallback = localeListResolutionCallback; |
|||
this.localeResolutionCallback = localeResolutionCallback; |
|||
this.supportedLocales = supportedLocales; |
|||
this.showPerformanceOverlay = showPerformanceOverlay; |
|||
this.checkerboardRasterCacheImages = checkerboardRasterCacheImages; |
|||
this.checkerboardOffscreenLayers = checkerboardOffscreenLayers; |
|||
this.showSemanticsDebugger = showSemanticsDebugger; |
|||
this.debugShowCheckedModeBanner = debugShowCheckedModeBanner; |
|||
} |
|||
|
|||
public readonly GlobalKey<NavigatorState> navigatorKey; |
|||
public readonly Widget home; |
|||
public readonly CupertinoThemeData theme; |
|||
public readonly Dictionary<string, WidgetBuilder> routes; |
|||
public readonly string initialRoute; |
|||
public readonly RouteFactory onGenerateRoute; |
|||
public readonly RouteFactory onUnknownRoute; |
|||
public readonly List<NavigatorObserver> navigatorObservers; |
|||
public readonly TransitionBuilder builder; |
|||
public readonly string title; |
|||
public readonly GenerateAppTitle onGenerateTitle; |
|||
public readonly Color color; |
|||
public readonly Locale locale; |
|||
public readonly List<LocalizationsDelegate<CupertinoLocalizations>> localizationsDelegates; |
|||
public readonly LocaleListResolutionCallback localeListResolutionCallback; |
|||
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 debugShowCheckedModeBanner; |
|||
|
|||
public override State createState() { |
|||
return new _CupertinoAppState(); |
|||
} |
|||
|
|||
public static HeroController createCupertinoHeroController() { |
|||
return new HeroController(); |
|||
} |
|||
} |
|||
|
|||
|
|||
public class _AlwaysCupertinoScrollBehavior : ScrollBehavior { |
|||
public override Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) { |
|||
return child; |
|||
} |
|||
|
|||
public override ScrollPhysics getScrollPhysics(BuildContext context) { |
|||
return new BouncingScrollPhysics(); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoAppState : State<CupertinoApp> { |
|||
HeroController _heroController; |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._heroController = CupertinoApp.createCupertinoHeroController(); |
|||
this._updateNavigator(); |
|||
} |
|||
|
|||
public override void didUpdateWidget(StatefulWidget oldWidget) { |
|||
base.didUpdateWidget(oldWidget); |
|||
if (this.widget.navigatorKey != ((CupertinoApp) oldWidget).navigatorKey) { |
|||
this._heroController = CupertinoApp.createCupertinoHeroController(); |
|||
} |
|||
|
|||
this._updateNavigator(); |
|||
} |
|||
|
|||
List<NavigatorObserver> _navigatorObservers; |
|||
|
|||
void _updateNavigator() { |
|||
if (this.widget.home != null || this.widget.routes.isNotEmpty() || this.widget.onGenerateRoute != null || |
|||
this.widget.onUnknownRoute != null) { |
|||
this._navigatorObservers = new List<NavigatorObserver>(); |
|||
foreach (var item in this.widget.navigatorObservers) { |
|||
this._navigatorObservers.Add(item); |
|||
} |
|||
} |
|||
else { |
|||
this._navigatorObservers = new List<NavigatorObserver>(); |
|||
} |
|||
} |
|||
|
|||
List<LocalizationsDelegate> _localizationsDelegates { |
|||
get { |
|||
List<LocalizationsDelegate<CupertinoLocalizations>> _delegates = |
|||
new List<LocalizationsDelegate<CupertinoLocalizations>>(); |
|||
if (this.widget.localizationsDelegates != null) { |
|||
_delegates.AddRange(this.widget.localizationsDelegates); |
|||
} |
|||
|
|||
_delegates.Add(DefaultCupertinoLocalizations.del); |
|||
return new List<LocalizationsDelegate>(_delegates); |
|||
} |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
CupertinoThemeData effectiveThemeData = this.widget.theme ?? new CupertinoThemeData(); |
|||
|
|||
Widget _InspectorSelectButtonBuilder(BuildContext _context, VoidCallback onPressed) { |
|||
return CupertinoButton.filled( |
|||
child: new Icon( |
|||
CupertinoIcons.search, |
|||
size: 28.0f, |
|||
color: CupertinoColors.white |
|||
), |
|||
padding: EdgeInsets.zero, |
|||
onPressed: onPressed |
|||
); |
|||
} |
|||
|
|||
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: this.widget.home, |
|||
routes: this.widget.routes, |
|||
initialRoute: this.widget.initialRoute, |
|||
onGenerateRoute: this.widget.onGenerateRoute, |
|||
onUnknownRoute: this.widget.onUnknownRoute, |
|||
builder: this.widget.builder, |
|||
title: this.widget.title, |
|||
onGenerateTitle: this.widget.onGenerateTitle, |
|||
textStyle: effectiveThemeData.textTheme.textStyle, |
|||
color: this.widget.color ?? CupertinoColors.activeBlue, |
|||
locale: this.widget.locale, |
|||
localizationsDelegates: this._localizationsDelegates, |
|||
localeResolutionCallback: this.widget.localeResolutionCallback, |
|||
localeListResolutionCallback: this.widget.localeListResolutionCallback, |
|||
supportedLocales: this.widget.supportedLocales, |
|||
showPerformanceOverlay: this.widget.showPerformanceOverlay, |
|||
checkerboardRasterCacheImages: this.widget.checkerboardRasterCacheImages, |
|||
checkerboardOffscreenLayers: this.widget.checkerboardOffscreenLayers, |
|||
showSemanticsDebugger: this.widget.showSemanticsDebugger, |
|||
debugShowCheckedModeBanner: this.widget.debugShowCheckedModeBanner, |
|||
inspectorSelectButtonBuilder: _InspectorSelectButtonBuilder |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ae05cbcca3d324a2da3b3aadbb2f124d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.scheduler; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
public class CupertinoButtonUtils { |
|||
public static Color _kDisabledBackground = new Color(0xFFA9A9A9); |
|||
public static Color _kDisabledForeground = new Color(0xFFD1D1D1); |
|||
public static EdgeInsets _kButtonPadding = EdgeInsets.all(16.0f); |
|||
public static EdgeInsets _kBackgroundButtonPadding = EdgeInsets.symmetric(vertical: 14.0f, horizontal: 64.0f); |
|||
} |
|||
|
|||
public class CupertinoButton : StatefulWidget { |
|||
public CupertinoButton( |
|||
Widget child, |
|||
VoidCallback onPressed, |
|||
Key key = null, |
|||
EdgeInsets padding = null, |
|||
Color color = null, |
|||
Color disabledColor = null, |
|||
float minSize = 44.0f, |
|||
float pressedOpacity = 0.1f, |
|||
BorderRadius borderRadius = null, |
|||
bool filled = false |
|||
) : base(key: key) { |
|||
D.assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)); |
|||
this._filled = filled; |
|||
this.child = child; |
|||
this.onPressed = onPressed; |
|||
this.padding = padding; |
|||
this.color = color; |
|||
this.disabledColor = disabledColor; |
|||
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, |
|||
EdgeInsets padding = null, |
|||
Color disabledColor = null, |
|||
float minSize = 44.0f, |
|||
float pressedOpacity = 0.1f, |
|||
BorderRadius borderRadius = null |
|||
) { |
|||
D.assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)); |
|||
return new CupertinoButton( |
|||
key: key, |
|||
color: null, |
|||
child: child, |
|||
onPressed: onPressed, |
|||
padding: padding, |
|||
disabledColor: disabledColor, |
|||
minSize: minSize, |
|||
pressedOpacity: pressedOpacity, |
|||
borderRadius: borderRadius, |
|||
filled: true |
|||
); |
|||
} |
|||
|
|||
public readonly Widget child; |
|||
|
|||
public readonly EdgeInsets padding; |
|||
|
|||
public readonly Color color; |
|||
|
|||
public readonly Color disabledColor; |
|||
|
|||
public readonly VoidCallback onPressed; |
|||
|
|||
public readonly float minSize; |
|||
|
|||
public readonly float? pressedOpacity; |
|||
|
|||
public readonly BorderRadius borderRadius; |
|||
public readonly bool _filled; |
|||
|
|||
public bool enabled { |
|||
get { return this.onPressed != null; } |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _CupertinoButtonState(); |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
properties.add(new FlagProperty("enabled", value: this.enabled, ifFalse: "disabled")); |
|||
} |
|||
} |
|||
|
|||
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); |
|||
AnimationController _animationController; |
|||
Animation<float> _opacityAnimation; |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._animationController = new AnimationController( |
|||
duration: new TimeSpan(0, 0, 0, 0, 200), |
|||
value: 0.0f, |
|||
vsync: this); |
|||
this._opacityAnimation = this._animationController |
|||
.drive(new CurveTween(curve: Curves.decelerate)) |
|||
.drive(this._opacityTween); |
|||
this._setTween(); |
|||
} |
|||
|
|||
public override void didUpdateWidget(StatefulWidget old) { |
|||
base.didUpdateWidget(old); |
|||
this._setTween(); |
|||
} |
|||
|
|||
void _setTween() { |
|||
if (this.widget != null) { |
|||
this._opacityTween.end = this.widget.pressedOpacity ?? 1.0f; |
|||
} |
|||
} |
|||
|
|||
public override void dispose() { |
|||
this._animationController.dispose(); |
|||
this._animationController = null; |
|||
base.dispose(); |
|||
} |
|||
|
|||
bool _buttonHeldDown = false; |
|||
|
|||
void _handleTapDown(TapDownDetails evt) { |
|||
if (!this._buttonHeldDown) { |
|||
this._buttonHeldDown = true; |
|||
this._animate(); |
|||
} |
|||
} |
|||
|
|||
void _handleTapUp(TapUpDetails evt) { |
|||
if (this._buttonHeldDown) { |
|||
this._buttonHeldDown = false; |
|||
this._animate(); |
|||
} |
|||
} |
|||
|
|||
void _handleTapCancel() { |
|||
if (this._buttonHeldDown) { |
|||
this._buttonHeldDown = false; |
|||
this._animate(); |
|||
} |
|||
} |
|||
|
|||
void _animate() { |
|||
if (this._animationController.isAnimating) { |
|||
return; |
|||
} |
|||
|
|||
bool wasHeldDown = this._buttonHeldDown; |
|||
|
|||
TickerFuture ticker = this._buttonHeldDown |
|||
? this._animationController.animateTo(1.0f, duration: kFadeOutDuration) |
|||
: this._animationController.animateTo(0.0f, duration: kFadeInDuration); |
|||
|
|||
ticker.Then<VoidCallback>(() => { |
|||
if (this.mounted && wasHeldDown != this._buttonHeldDown) { |
|||
this._animate(); |
|||
} |
|||
|
|||
return null; |
|||
}); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
bool enabled = this.widget.enabled; |
|||
Color primaryColor = CupertinoTheme.of(context).primaryColor; |
|||
Color backgroundColor = this.widget.color ?? (this.widget._filled ? primaryColor : null); |
|||
|
|||
Color foregroundColor = backgroundColor != null |
|||
? CupertinoTheme.of(context).primaryContrastingColor |
|||
: enabled |
|||
? primaryColor |
|||
: CupertinoButtonUtils._kDisabledForeground; |
|||
|
|||
TextStyle textStyle = |
|||
CupertinoTheme.of(context).textTheme.textStyle.copyWith(color: foregroundColor); |
|||
return new GestureDetector( |
|||
behavior: HitTestBehavior.opaque, |
|||
onTapDown: enabled ? this._handleTapDown : (GestureTapDownCallback) null, |
|||
onTapUp: enabled ? this._handleTapUp : (GestureTapUpCallback) null, |
|||
onTapCancel: enabled ? this._handleTapCancel : (GestureTapCancelCallback) null, |
|||
onTap: this.widget.onPressed == null |
|||
? (GestureTapCallback) null |
|||
: () => { |
|||
if (this.widget.onPressed != null) { |
|||
this.widget.onPressed(); |
|||
} |
|||
}, |
|||
child: new ConstrainedBox( |
|||
constraints: this.widget.minSize == null |
|||
? new BoxConstraints() |
|||
: new BoxConstraints( |
|||
minWidth: this.widget.minSize, |
|||
minHeight: this.widget.minSize |
|||
), |
|||
child: new FadeTransition( |
|||
opacity: this._opacityAnimation, |
|||
child: new DecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
borderRadius: this.widget.borderRadius, |
|||
color: backgroundColor != null && !enabled |
|||
? this.widget.disabledColor ?? CupertinoButtonUtils._kDisabledBackground |
|||
: backgroundColor |
|||
), |
|||
child: new Padding( |
|||
padding: this.widget.padding ?? (backgroundColor != null |
|||
? CupertinoButtonUtils._kBackgroundButtonPadding |
|||
: CupertinoButtonUtils._kButtonPadding), |
|||
child: new Center( |
|||
widthFactor: 1.0f, |
|||
heightFactor: 1.0f, |
|||
child: new DefaultTextStyle( |
|||
style: textStyle, |
|||
child: new IconTheme( |
|||
data: new IconThemeData(color: foregroundColor), |
|||
child: this.widget.child |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7c17a9b64e1654955af4ee61cc15780b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.ui; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
public class CupertinoColors { |
|||
public static Color activeBlue = new Color(0xFF007AFF); |
|||
|
|||
public static Color activeGreen = new Color(0xFF4CD964); |
|||
|
|||
public static Color activeOrange = new Color(0xFFFF9500); |
|||
|
|||
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 Color inactiveGray = new Color(0xFF8E8E93); |
|||
|
|||
public static Color destructiveRed = new Color(0xFFFF3B30); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 621f7fba7472f4619a8a7429071a58c0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
public static class CupertinoIcons { |
|||
public static string iconFont = "CupertinoIcons"; |
|||
|
|||
public static IconData left_chevron = new IconData(0xf3d2, fontFamily: iconFont); |
|||
public static IconData right_chevron = new IconData(0xf3d3, fontFamily: iconFont); |
|||
public static IconData share = new IconData(0xf4ca, fontFamily: iconFont); |
|||
public static IconData share_solid = new IconData(0xf4cb, fontFamily: iconFont); |
|||
public static IconData book = new IconData(0xf3e7, fontFamily: iconFont); |
|||
public static IconData book_solid = new IconData(0xf3e8, fontFamily: iconFont); |
|||
public static IconData bookmark = new IconData(0xf3e9, fontFamily: iconFont); |
|||
public static IconData bookmark_solid = new IconData(0xf3ea, fontFamily: iconFont); |
|||
public static IconData info = new IconData(0xf44c, fontFamily: iconFont); |
|||
public static IconData reply = new IconData(0xf4c6, fontFamily: iconFont); |
|||
public static IconData conversation_bubble = new IconData(0xf3fb, fontFamily: iconFont); |
|||
public static IconData profile_circled = new IconData(0xf419, fontFamily: iconFont); |
|||
public static IconData plus_circled = new IconData(0xf48a, fontFamily: iconFont); |
|||
public static IconData minus_circled = new IconData(0xf463, fontFamily: iconFont); |
|||
public static IconData flag = new IconData(0xf42c, fontFamily: iconFont); |
|||
public static IconData search = new IconData(0xf4a5, fontFamily: iconFont); |
|||
public static IconData check_mark = new IconData(0xf3fd, fontFamily: iconFont); |
|||
public static IconData check_mark_circled = new IconData(0xf3fe, fontFamily: iconFont); |
|||
public static IconData check_mark_circled_solid = new IconData(0xf3ff, fontFamily: iconFont); |
|||
public static IconData circle = new IconData(0xf401, fontFamily: iconFont); |
|||
public static IconData circle_filled = new IconData(0xf400, fontFamily: iconFont); |
|||
public static IconData back = new IconData(0xf3cf, fontFamily: iconFont); |
|||
public static IconData forward = new IconData(0xf3d1, fontFamily: iconFont); |
|||
public static IconData home = new IconData(0xf447, fontFamily: iconFont); |
|||
public static IconData shopping_cart = new IconData(0xf3f7, fontFamily: iconFont); |
|||
public static IconData ellipsis = new IconData(0xf46a, fontFamily: iconFont); |
|||
public static IconData phone = new IconData(0xf4b8, fontFamily: iconFont); |
|||
public static IconData phone_solid = new IconData(0xf4b9, fontFamily: iconFont); |
|||
public static IconData down_arrow = new IconData(0xf35d, fontFamily: iconFont); |
|||
public static IconData up_arrow = new IconData(0xf366, fontFamily: iconFont); |
|||
public static IconData battery_charging = new IconData(0xf111, fontFamily: iconFont); |
|||
public static IconData battery_empty = new IconData(0xf112, fontFamily: iconFont); |
|||
public static IconData battery_full = new IconData(0xf113, fontFamily: iconFont); |
|||
public static IconData battery_75_percent = new IconData(0xf114, fontFamily: iconFont); |
|||
public static IconData battery_25_percent = new IconData(0xf115, fontFamily: iconFont); |
|||
public static IconData bluetooth = new IconData(0xf116, fontFamily: iconFont); |
|||
public static IconData restart = new IconData(0xf21c, fontFamily: iconFont); |
|||
public static IconData reply_all = new IconData(0xf21d, fontFamily: iconFont); |
|||
public static IconData reply_thick_solid = new IconData(0xf21e, fontFamily: iconFont); |
|||
public static IconData share_up = new IconData(0xf220, fontFamily: iconFont); |
|||
public static IconData shuffle_thick = new IconData(0xf221, fontFamily: iconFont); |
|||
public static IconData photo_camera = new IconData(0xf3f5, fontFamily: iconFont); |
|||
public static IconData photo_camera_solid = new IconData(0xf3f6, fontFamily: iconFont); |
|||
public static IconData video_camera = new IconData(0xf4cc, fontFamily: iconFont); |
|||
public static IconData video_camera_solid = new IconData(0xf4cd, fontFamily: iconFont); |
|||
public static IconData switch_camera = new IconData(0xf49e, fontFamily: iconFont); |
|||
public static IconData switch_camera_solid = new IconData(0xf49f, fontFamily: iconFont); |
|||
public static IconData collections = new IconData(0xf3c9, fontFamily: iconFont); |
|||
public static IconData collections_solid = new IconData(0xf3ca, fontFamily: iconFont); |
|||
public static IconData folder = new IconData(0xf434, fontFamily: iconFont); |
|||
public static IconData folder_solid = new IconData(0xf435, fontFamily: iconFont); |
|||
public static IconData folder_open = new IconData(0xf38a, fontFamily: iconFont); |
|||
public static IconData delete = new IconData(0xf4c4, fontFamily: iconFont); |
|||
public static IconData delete_solid = new IconData(0xf4c5, fontFamily: iconFont); |
|||
public static IconData delete_simple = new IconData(0xf37f, fontFamily: iconFont); |
|||
public static IconData pen = new IconData(0xf2bf, fontFamily: iconFont); |
|||
public static IconData pencil = new IconData(0xf37e, fontFamily: iconFont); |
|||
public static IconData create = new IconData(0xf417, fontFamily: iconFont); |
|||
public static IconData create_solid = new IconData(0xf417, fontFamily: iconFont); |
|||
public static IconData refresh = new IconData(0xf49a, fontFamily: iconFont); |
|||
public static IconData refresh_circled = new IconData(0xf49b, fontFamily: iconFont); |
|||
public static IconData refresh_circled_solid = new IconData(0xf49c, fontFamily: iconFont); |
|||
public static IconData refresh_thin = new IconData(0xf49d, fontFamily: iconFont); |
|||
public static IconData refresh_thick = new IconData(0xf3a8, fontFamily: iconFont); |
|||
public static IconData refresh_bold = new IconData(0xf21c, fontFamily: iconFont); |
|||
public static IconData clear_thick = new IconData(0xf2d7, fontFamily: iconFont); |
|||
public static IconData clear_thick_circled = new IconData(0xf36e, fontFamily: iconFont); |
|||
public static IconData clear = new IconData(0xf404, fontFamily: iconFont); |
|||
public static IconData clear_circled = new IconData(0xf405, fontFamily: iconFont); |
|||
public static IconData clear_circled_solid = new IconData(0xf406, fontFamily: iconFont); |
|||
public static IconData add = new IconData(0xf489, fontFamily: iconFont); |
|||
public static IconData add_circled = new IconData(0xf48a, fontFamily: iconFont); |
|||
public static IconData add_circled_solid = new IconData(0xf48b, fontFamily: iconFont); |
|||
public static IconData gear = new IconData(0xf43c, fontFamily: iconFont); |
|||
public static IconData gear_solid = new IconData(0xf43d, fontFamily: iconFont); |
|||
public static IconData gear_big = new IconData(0xf2f7, fontFamily: iconFont); |
|||
public static IconData settings = new IconData(0xf411, fontFamily: iconFont); |
|||
public static IconData settings_solid = new IconData(0xf412, fontFamily: iconFont); |
|||
public static IconData music_note = new IconData(0xf46b, fontFamily: iconFont); |
|||
public static IconData double_music_note = new IconData(0xf46c, fontFamily: iconFont); |
|||
public static IconData play_arrow = new IconData(0xf487, fontFamily: iconFont); |
|||
public static IconData play_arrow_solid = new IconData(0xf488, fontFamily: iconFont); |
|||
public static IconData pause = new IconData(0xf477, fontFamily: iconFont); |
|||
public static IconData pause_solid = new IconData(0xf478, fontFamily: iconFont); |
|||
public static IconData loop = new IconData(0xf449, fontFamily: iconFont); |
|||
public static IconData loop_thick = new IconData(0xf44a, fontFamily: iconFont); |
|||
public static IconData volume_down = new IconData(0xf3b7, fontFamily: iconFont); |
|||
public static IconData volume_mute = new IconData(0xf3b8, fontFamily: iconFont); |
|||
public static IconData volume_off = new IconData(0xf3b9, fontFamily: iconFont); |
|||
public static IconData volume_up = new IconData(0xf3ba, fontFamily: iconFont); |
|||
public static IconData fullscreen = new IconData(0xf386, fontFamily: iconFont); |
|||
public static IconData fullscreen_exit = new IconData(0xf37d, fontFamily: iconFont); |
|||
public static IconData mic_off = new IconData(0xf45f, fontFamily: iconFont); |
|||
public static IconData mic = new IconData(0xf460, fontFamily: iconFont); |
|||
public static IconData mic_solid = new IconData(0xf461, fontFamily: iconFont); |
|||
public static IconData clock = new IconData(0xf4be, fontFamily: iconFont); |
|||
public static IconData clock_solid = new IconData(0xf4bf, fontFamily: iconFont); |
|||
public static IconData time = new IconData(0xf402, fontFamily: iconFont); |
|||
public static IconData time_solid = new IconData(0xf403, fontFamily: iconFont); |
|||
public static IconData padlock = new IconData(0xf4c8, fontFamily: iconFont); |
|||
public static IconData padlock_solid = new IconData(0xf4c9, fontFamily: iconFont); |
|||
public static IconData eye = new IconData(0xf424, fontFamily: iconFont); |
|||
public static IconData eye_solid = new IconData(0xf425, fontFamily: iconFont); |
|||
public static IconData person = new IconData(0xf47d, fontFamily: iconFont); |
|||
public static IconData person_solid = new IconData(0xf47e, fontFamily: iconFont); |
|||
public static IconData person_add = new IconData(0xf47f, fontFamily: iconFont); |
|||
public static IconData person_add_solid = new IconData(0xf480, fontFamily: iconFont); |
|||
public static IconData group = new IconData(0xf47b, fontFamily: iconFont); |
|||
public static IconData group_solid = new IconData(0xf47c, fontFamily: iconFont); |
|||
public static IconData mail = new IconData(0xf422, fontFamily: iconFont); |
|||
public static IconData mail_solid = new IconData(0xf423, fontFamily: iconFont); |
|||
public static IconData location = new IconData(0xf455, fontFamily: iconFont); |
|||
public static IconData location_solid = new IconData(0xf456, fontFamily: iconFont); |
|||
public static IconData tag = new IconData(0xf48c, fontFamily: iconFont); |
|||
public static IconData tag_solid = new IconData(0xf48d, fontFamily: iconFont); |
|||
public static IconData tags = new IconData(0xf48e, fontFamily: iconFont); |
|||
public static IconData tags_solid = new IconData(0xf48f, fontFamily: iconFont); |
|||
public static IconData bus = new IconData(0xf36d, fontFamily: iconFont); |
|||
public static IconData car = new IconData(0xf36f, fontFamily: iconFont); |
|||
public static IconData car_detailed = new IconData(0xf2c1, fontFamily: iconFont); |
|||
public static IconData train_style_one = new IconData(0xf3af, fontFamily: iconFont); |
|||
public static IconData train_style_two = new IconData(0xf3b4, fontFamily: iconFont); |
|||
public static IconData paw = new IconData(0xf479, fontFamily: iconFont); |
|||
public static IconData paw_solid = new IconData(0xf47a, fontFamily: iconFont); |
|||
public static IconData game_controller = new IconData(0xf43a, fontFamily: iconFont); |
|||
public static IconData game_controller_solid = new IconData(0xf43b, fontFamily: iconFont); |
|||
public static IconData lab_flask = new IconData(0xf430, fontFamily: iconFont); |
|||
public static IconData lab_flask_solid = new IconData(0xf431, fontFamily: iconFont); |
|||
public static IconData heart = new IconData(0xf442, fontFamily: iconFont); |
|||
public static IconData heart_solid = new IconData(0xf443, fontFamily: iconFont); |
|||
public static IconData bell = new IconData(0xf3e1, fontFamily: iconFont); |
|||
public static IconData bell_solid = new IconData(0xf3e2, fontFamily: iconFont); |
|||
public static IconData news = new IconData(0xf471, fontFamily: iconFont); |
|||
public static IconData news_solid = new IconData(0xf472, fontFamily: iconFont); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1a5cd7317c4754d8fa8108ac59749344 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RSG; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
public enum DatePickerDateTimeOrder { |
|||
date_time_dayPeriod, |
|||
date_dayPeriod_time, |
|||
time_dayPeriod_date, |
|||
dayPeriod_time_date |
|||
} |
|||
|
|||
public enum DatePickerDateOrder { |
|||
dmy, |
|||
mdy, |
|||
ymd, |
|||
ydm |
|||
} |
|||
|
|||
public abstract class CupertinoLocalizations { |
|||
public abstract string datePickerYear(int yearIndex); |
|||
|
|||
public abstract string datePickerMonth(int monthIndex); |
|||
|
|||
public abstract string datePickerDayOfMonth(int dayIndex); |
|||
|
|||
public abstract string datePickerMediumDate(DateTime date); |
|||
|
|||
public abstract string datePickerHour(int hour); |
|||
|
|||
public abstract string datePickerHourSemanticsLabel(int hour); |
|||
|
|||
public abstract string datePickerMinute(int minute); |
|||
|
|||
public abstract string datePickerMinuteSemanticsLabel(int minute); |
|||
|
|||
public abstract DatePickerDateOrder datePickerDateOrder { get; } |
|||
|
|||
public abstract DatePickerDateTimeOrder datePickerDateTimeOrder { get; } |
|||
|
|||
public abstract string anteMeridiemAbbreviation { get; } |
|||
|
|||
public abstract string postMeridiemAbbreviation { get; } |
|||
|
|||
public abstract string alertDialogLabel { get; } |
|||
|
|||
public abstract string timerPickerHour(int hour); |
|||
|
|||
public abstract string timerPickerMinute(int minute); |
|||
|
|||
public abstract string timerPickerSecond(int second); |
|||
|
|||
public abstract string timerPickerHourLabel(int hour); |
|||
|
|||
public abstract string timerPickerMinuteLabel(int minute); |
|||
|
|||
public abstract string timerPickerSecondLabel(int second); |
|||
|
|||
public abstract string cutButtonLabel { get; } |
|||
|
|||
public abstract string copyButtonLabel { get; } |
|||
|
|||
public abstract string pasteButtonLabel { get; } |
|||
|
|||
public abstract string selectAllButtonLabel { get; } |
|||
|
|||
public static CupertinoLocalizations of(BuildContext context) { |
|||
return Localizations.of<CupertinoLocalizations>(context, typeof(CupertinoLocalizations)); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoLocalizationsDelegate : LocalizationsDelegate<CupertinoLocalizations> { |
|||
public _CupertinoLocalizationsDelegate() { } |
|||
|
|||
public override bool isSupported(Locale locale) { |
|||
return locale.languageCode == "en"; |
|||
} |
|||
|
|||
public override IPromise<object> load(Locale locale) { |
|||
return DefaultCupertinoLocalizations.load(locale); |
|||
} |
|||
|
|||
public override bool shouldReload(LocalizationsDelegate old) { |
|||
return false; |
|||
} |
|||
|
|||
public override string ToString() { |
|||
return "DefaultCupertinoLocalizations.delegate(en_US)"; |
|||
} |
|||
} |
|||
|
|||
public class DefaultCupertinoLocalizations : CupertinoLocalizations { |
|||
public DefaultCupertinoLocalizations() { } |
|||
|
|||
static readonly List<string> _shortWeekdays = new List<string> { |
|||
"Mon", |
|||
"Tue", |
|||
"Wed", |
|||
"Thu", |
|||
"Fri", |
|||
"Sat", |
|||
"Sun" |
|||
}; |
|||
|
|||
static readonly List<string> _shortMonths = new List<string> { |
|||
"Jan", |
|||
"Feb", |
|||
"Mar", |
|||
"Apr", |
|||
"May", |
|||
"Jun", |
|||
"Jul", |
|||
"Aug", |
|||
"Sep", |
|||
"Oct", |
|||
"Nov", |
|||
"Dec" |
|||
}; |
|||
|
|||
static readonly List<string> _months = new List<string> { |
|||
"January", |
|||
"February", |
|||
"March", |
|||
"April", |
|||
"May", |
|||
"June", |
|||
"July", |
|||
"August", |
|||
"September", |
|||
"October", |
|||
"November", |
|||
"December" |
|||
}; |
|||
|
|||
public override string datePickerYear(int yearIndex) { |
|||
return yearIndex.ToString(); |
|||
} |
|||
|
|||
public override string datePickerMonth(int monthIndex) { |
|||
return _months[monthIndex - 1]; |
|||
} |
|||
|
|||
public override string datePickerDayOfMonth(int dayIndex) { |
|||
return dayIndex.ToString(); |
|||
} |
|||
|
|||
public override string datePickerHour(int hour) { |
|||
return hour.ToString(); |
|||
} |
|||
|
|||
public override string datePickerHourSemanticsLabel(int hour) { |
|||
return hour.ToString() + " o'clock"; |
|||
} |
|||
|
|||
public override string datePickerMinute(int minute) { |
|||
return minute.ToString().PadLeft(2, '0'); |
|||
} |
|||
|
|||
public override string datePickerMinuteSemanticsLabel(int minute) { |
|||
if (minute == 1) { |
|||
return "1 minute"; |
|||
} |
|||
|
|||
return minute.ToString() + " minutes"; |
|||
} |
|||
|
|||
public override string datePickerMediumDate(DateTime date) { |
|||
var day = _shortWeekdays[((int) date.DayOfWeek + 6) % 7]; |
|||
var month = _shortMonths[date.Month - 1]; |
|||
return $"{day}, {month} {date.Day.ToString().PadRight(2)} "; |
|||
} |
|||
|
|||
public override DatePickerDateOrder datePickerDateOrder { |
|||
get { return DatePickerDateOrder.mdy; } |
|||
} |
|||
|
|||
public override DatePickerDateTimeOrder datePickerDateTimeOrder { |
|||
get { return DatePickerDateTimeOrder.date_time_dayPeriod; } |
|||
} |
|||
|
|||
public override string anteMeridiemAbbreviation { |
|||
get { return "AM"; } |
|||
} |
|||
|
|||
public override string postMeridiemAbbreviation { |
|||
get { return "PM"; } |
|||
} |
|||
|
|||
public override string alertDialogLabel { |
|||
get { return "Alert"; } |
|||
} |
|||
|
|||
public override string timerPickerHour(int hour) { |
|||
return hour.ToString(); |
|||
} |
|||
|
|||
public override string timerPickerMinute(int minute) { |
|||
return minute.ToString(); |
|||
} |
|||
|
|||
public override string timerPickerSecond(int second) { |
|||
return second.ToString(); |
|||
} |
|||
|
|||
public override string timerPickerHourLabel(int hour) { |
|||
return hour == 1 ? "hour" : "hours"; |
|||
} |
|||
|
|||
public override string timerPickerMinuteLabel(int minute) { |
|||
return "min"; |
|||
} |
|||
|
|||
public override string timerPickerSecondLabel(int second) { |
|||
return "sec"; |
|||
} |
|||
|
|||
public override string cutButtonLabel { |
|||
get { return "Cut"; } |
|||
} |
|||
|
|||
public override string copyButtonLabel { |
|||
get { return "Copy"; } |
|||
} |
|||
|
|||
public override string pasteButtonLabel { |
|||
get { return "Paste"; } |
|||
} |
|||
|
|||
public override string selectAllButtonLabel { |
|||
get { return "Select All"; } |
|||
} |
|||
|
|||
public static IPromise<object> load(Locale locale) { |
|||
return Promise<object>.Resolved(new DefaultCupertinoLocalizations()); |
|||
} |
|||
|
|||
public static readonly LocalizationsDelegate<CupertinoLocalizations> |
|||
del = new _CupertinoLocalizationsDelegate(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: db635d91487ab4ea49c0a23ca5b6cc85 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RSG; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Canvas = Unity.UIWidgets.ui.Canvas; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Rect = Unity.UIWidgets.ui.Rect; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
public class CupertinoRouteUtils { |
|||
public const float _kBackGestureWidth = 20.0f; |
|||
public const float _kMinFlingVelocity = 1.0f; |
|||
|
|||
public const int _kMaxDroppedSwipePageForwardAnimationTime = 800; // Milliseconds.
|
|||
|
|||
public const int _kMaxPageBackAnimationTime = 300; // Milliseconds.
|
|||
|
|||
public static Color _kModalBarrierColor = new Color(0x6604040F); |
|||
|
|||
public static TimeSpan _kModalPopupTransitionDuration = new TimeSpan(0, 0, 0, 0, 335); |
|||
|
|||
public static Animatable<Offset> _kRightMiddleTween = new OffsetTween( |
|||
begin: new Offset(1.0f, 0.0f), |
|||
end: Offset.zero |
|||
); |
|||
|
|||
public static Animatable<Offset> _kMiddleLeftTween = new OffsetTween( |
|||
begin: Offset.zero, |
|||
end: new Offset(-1.0f / 3.0f, 0.0f) |
|||
); |
|||
|
|||
public static Animatable<Offset> _kBottomUpTween = new OffsetTween( |
|||
begin: new Offset(0.0f, 1.0f), |
|||
end: Offset.zero |
|||
); |
|||
|
|||
public static DecorationTween _kGradientShadowTween = new DecorationTween( |
|||
end: new _CupertinoEdgeShadowDecoration( |
|||
edgeGradient: new LinearGradient( |
|||
begin: new Alignment(0.9f, 0.0f), |
|||
end: Alignment.centerRight, |
|||
colors: new List<Color> { |
|||
new Color(0x00000000), |
|||
new Color(0x04000000), |
|||
new Color(0x12000000), |
|||
new Color(0x38000000), |
|||
}, |
|||
stops: new List<float> {0.0f, 0.3f, 0.6f, 1.0f} |
|||
) |
|||
) |
|||
); |
|||
|
|||
|
|||
public static IPromise<T> showCupertinoModalPopup<T>( |
|||
BuildContext context, |
|||
WidgetBuilder builder |
|||
) { |
|||
return (IPromise<T>) Navigator.of(context, rootNavigator: true).push( |
|||
new _CupertinoModalPopupRoute( |
|||
builder: builder, |
|||
barrierLabel: "Dismiss" |
|||
) |
|||
); |
|||
} |
|||
|
|||
|
|||
public static Animatable<float> _dialogScaleTween = new FloatTween(begin: 1.3f, end: 1.0f) |
|||
.chain(new CurveTween(curve: Curves.linearToEaseOut)); |
|||
|
|||
public static Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<float> animation, |
|||
Animation<float> |
|||
secondaryAnimation, Widget child) { |
|||
CurvedAnimation fadeAnimation = new CurvedAnimation( |
|||
parent: animation, |
|||
curve: Curves.easeInOut |
|||
); |
|||
if (animation.status == AnimationStatus.reverse) { |
|||
return new FadeTransition( |
|||
opacity: fadeAnimation, |
|||
child: child |
|||
); |
|||
} |
|||
|
|||
return new FadeTransition( |
|||
opacity: fadeAnimation, |
|||
child: new ScaleTransition( |
|||
child: child, |
|||
scale: animation.drive(_dialogScaleTween) |
|||
) |
|||
); |
|||
} |
|||
|
|||
public static IPromise<T> showCupertinoDialog<T>( |
|||
BuildContext context, |
|||
WidgetBuilder builder |
|||
) { |
|||
D.assert(builder != null); |
|||
return (IPromise<T>) DialogUtils.showGeneralDialog( |
|||
context: context, |
|||
barrierDismissible: false, |
|||
barrierColor: _kModalBarrierColor, |
|||
transitionDuration: new TimeSpan(0, 0, 0, 0, 250), |
|||
pageBuilder: |
|||
(BuildContext _context, Animation<float> animation, Animation<float> secondaryAnimation) => { |
|||
return builder(_context); |
|||
}, |
|||
transitionBuilder: _buildCupertinoDialogTransitions |
|||
); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoEdgeShadowDecoration : Decoration, IEquatable<_CupertinoEdgeShadowDecoration> { |
|||
public _CupertinoEdgeShadowDecoration( |
|||
LinearGradient edgeGradient = null |
|||
) { |
|||
this.edgeGradient = edgeGradient; |
|||
} |
|||
|
|||
public static _CupertinoEdgeShadowDecoration none = |
|||
new _CupertinoEdgeShadowDecoration(); |
|||
|
|||
public readonly LinearGradient edgeGradient; |
|||
|
|||
static _CupertinoEdgeShadowDecoration lerp( |
|||
_CupertinoEdgeShadowDecoration a, |
|||
_CupertinoEdgeShadowDecoration b, |
|||
float t |
|||
) { |
|||
D.assert(t != null); |
|||
if (a == null && b == null) { |
|||
return null; |
|||
} |
|||
|
|||
return new _CupertinoEdgeShadowDecoration( |
|||
edgeGradient: LinearGradient.lerp(a?.edgeGradient, b?.edgeGradient, t) |
|||
); |
|||
} |
|||
|
|||
public override Decoration lerpFrom(Decoration a, float t) { |
|||
if (!(a is _CupertinoEdgeShadowDecoration)) { |
|||
return lerp(null, this, t); |
|||
} |
|||
|
|||
return lerp(a, this, t); |
|||
} |
|||
|
|||
public override Decoration lerpTo(Decoration b, float t) { |
|||
if (!(b is _CupertinoEdgeShadowDecoration)) { |
|||
return lerp(this, null, t); |
|||
} |
|||
|
|||
return lerp(this, b, t); |
|||
} |
|||
|
|||
public override BoxPainter createBoxPainter(VoidCallback onChanged = null) { |
|||
return new _CupertinoEdgeShadowPainter(this, onChanged); |
|||
} |
|||
|
|||
public bool Equals(_CupertinoEdgeShadowDecoration other) { |
|||
if (ReferenceEquals(null, other)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, other)) { |
|||
return true; |
|||
} |
|||
|
|||
return Equals(this.edgeGradient, other.edgeGradient); |
|||
} |
|||
|
|||
public override bool Equals(object obj) { |
|||
if (ReferenceEquals(null, obj)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, obj)) { |
|||
return true; |
|||
} |
|||
|
|||
if (obj.GetType() != this.GetType()) { |
|||
return false; |
|||
} |
|||
|
|||
return this.Equals((_CupertinoEdgeShadowDecoration) obj); |
|||
} |
|||
|
|||
public static bool operator ==(_CupertinoEdgeShadowDecoration left, _CupertinoEdgeShadowDecoration right) { |
|||
return Equals(left, right); |
|||
} |
|||
|
|||
public static bool operator !=(_CupertinoEdgeShadowDecoration left, _CupertinoEdgeShadowDecoration right) { |
|||
return !Equals(left, right); |
|||
} |
|||
|
|||
public int hashCode { |
|||
get { return this.edgeGradient.GetHashCode(); } |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
properties.add(new DiagnosticsProperty<LinearGradient>("edgeGradient", this.edgeGradient)); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoEdgeShadowPainter : BoxPainter { |
|||
public _CupertinoEdgeShadowPainter( |
|||
_CupertinoEdgeShadowDecoration decoration = null, |
|||
VoidCallback onChange = null |
|||
) : base(onChange) { |
|||
D.assert(decoration != null); |
|||
this._decoration = decoration; |
|||
} |
|||
|
|||
readonly _CupertinoEdgeShadowDecoration _decoration; |
|||
|
|||
public override void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { |
|||
LinearGradient gradient = this._decoration.edgeGradient; |
|||
if (gradient == null) { |
|||
return; |
|||
} |
|||
|
|||
float deltaX = -configuration.size.width; |
|||
Rect rect = (offset & configuration.size).translate(deltaX, 0.0f); |
|||
Paint paint = new Paint(); |
|||
paint.shader = gradient.createShader(rect); |
|||
canvas.drawRect(rect, paint); |
|||
} |
|||
} |
|||
|
|||
public class CupertinoPageRoute : PageRoute { |
|||
public CupertinoPageRoute( |
|||
WidgetBuilder builder, |
|||
RouteSettings settings, |
|||
string title = "", |
|||
bool maintainState = true, |
|||
bool fullscreenDialog = false |
|||
) : |
|||
base(settings: settings, fullscreenDialog: fullscreenDialog) { |
|||
D.assert(builder != null); |
|||
D.assert(maintainState != null); |
|||
D.assert(fullscreenDialog != null); |
|||
D.assert(this.opaque); |
|||
this.builder = builder; |
|||
this.title = title; |
|||
this.maintainState = maintainState; |
|||
} |
|||
|
|||
public readonly WidgetBuilder builder; |
|||
public readonly string title; |
|||
ValueNotifier<string> _previousTitle; |
|||
|
|||
public ValueListenable<string> previousTitle { |
|||
get { |
|||
D.assert( |
|||
this._previousTitle != null, |
|||
() => "Cannot read the previousTitle for a route that has not yet been installed" |
|||
); |
|||
return this._previousTitle; |
|||
} |
|||
} |
|||
|
|||
protected internal override void didChangePrevious(Route previousRoute) { |
|||
string previousTitleString = previousRoute is CupertinoPageRoute |
|||
? ((CupertinoPageRoute) previousRoute).title |
|||
: null; |
|||
if (this._previousTitle == null) { |
|||
this._previousTitle = new ValueNotifier<string>(previousTitleString); |
|||
} |
|||
|
|||
else { |
|||
this._previousTitle.value = previousTitleString; |
|||
} |
|||
|
|||
base.didChangePrevious(previousRoute); |
|||
} |
|||
|
|||
public override bool maintainState { get; } |
|||
|
|||
public override TimeSpan transitionDuration { |
|||
get { return new TimeSpan(0, 0, 0, 0, 400); } |
|||
} |
|||
|
|||
public override Color barrierColor { |
|||
get { return null; } |
|||
} |
|||
|
|||
|
|||
public string barrierLabel { |
|||
get { return null; } |
|||
} |
|||
|
|||
|
|||
public override bool canTransitionFrom(TransitionRoute previousRoute) { |
|||
return previousRoute is CupertinoPageRoute; |
|||
} |
|||
|
|||
|
|||
public override bool canTransitionTo(TransitionRoute nextRoute) { |
|||
return nextRoute is CupertinoPageRoute && !((CupertinoPageRoute) nextRoute).fullscreenDialog; |
|||
} |
|||
|
|||
static bool isPopGestureInProgress(PageRoute route) { |
|||
return route.navigator.userGestureInProgress; |
|||
} |
|||
|
|||
|
|||
public bool popGestureInProgress { |
|||
get { return isPopGestureInProgress(this); } |
|||
} |
|||
|
|||
public bool popGestureEnabled { |
|||
get { return _isPopGestureEnabled(this); } |
|||
} |
|||
|
|||
static bool _isPopGestureEnabled(PageRoute route) { |
|||
if (route.isFirst) { |
|||
return false; |
|||
} |
|||
|
|||
if (route.willHandlePopInternally) { |
|||
return false; |
|||
} |
|||
|
|||
if (route._hasScopedWillPopCallback) { |
|||
return false; |
|||
} |
|||
|
|||
if (route.fullscreenDialog) { |
|||
return false; |
|||
} |
|||
|
|||
if (route.animation.status != AnimationStatus.completed) { |
|||
return false; |
|||
} |
|||
|
|||
if (route.secondaryAnimation.status != AnimationStatus.dismissed) { |
|||
return false; |
|||
} |
|||
|
|||
if (isPopGestureInProgress(route)) { |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
public override Widget buildPage(BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation) { |
|||
Widget result = this.builder(context); |
|||
|
|||
D.assert(() => { |
|||
if (result == null) { |
|||
throw new UIWidgetsError( |
|||
$"The builder for route {this.settings.name} returned null.\nRoute builders must never return null."); |
|||
} |
|||
|
|||
return true; |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
static _CupertinoBackGestureController _startPopGesture(PageRoute route) { |
|||
D.assert(_isPopGestureEnabled(route)); |
|||
return new _CupertinoBackGestureController( |
|||
navigator: route.navigator, |
|||
controller: route.controller |
|||
); |
|||
} |
|||
|
|||
public static Widget buildPageTransitions( |
|||
PageRoute route, |
|||
BuildContext context, |
|||
Animation<float> animation, |
|||
Animation<float> secondaryAnimation, |
|||
Widget child |
|||
) { |
|||
if (route.fullscreenDialog) { |
|||
return new CupertinoFullscreenDialogTransition( |
|||
animation: animation, |
|||
child: child |
|||
); |
|||
} |
|||
|
|||
else { |
|||
return new CupertinoPageTransition( |
|||
primaryRouteAnimation: animation, |
|||
secondaryRouteAnimation: secondaryAnimation, |
|||
linearTransition: isPopGestureInProgress(route), |
|||
child: new _CupertinoBackGestureDetector( |
|||
enabledCallback: () => _isPopGestureEnabled(route), |
|||
onStartPopGesture: () => _startPopGesture(route), |
|||
child: child |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public override Widget buildTransitions(BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation, Widget child) { |
|||
return buildPageTransitions(this, context, animation, secondaryAnimation, child); |
|||
} |
|||
|
|||
public string debugLabel { |
|||
get { return $"{base.debugLabel}(${this.settings.name})"; } |
|||
} |
|||
} |
|||
|
|||
class CupertinoPageTransition : StatelessWidget { |
|||
public CupertinoPageTransition( |
|||
Animation<float> primaryRouteAnimation, |
|||
Animation<float> secondaryRouteAnimation, |
|||
Widget child, |
|||
bool linearTransition, |
|||
Key key = null |
|||
) : base(key: key) { |
|||
D.assert(linearTransition != null); |
|||
this._primaryPositionAnimation = |
|||
(linearTransition |
|||
? primaryRouteAnimation |
|||
: new CurvedAnimation( |
|||
parent: primaryRouteAnimation, |
|||
curve: Curves.linearToEaseOut, |
|||
reverseCurve: Curves.easeInToLinear |
|||
) |
|||
).drive(CupertinoRouteUtils._kRightMiddleTween); |
|||
|
|||
this._secondaryPositionAnimation = |
|||
(linearTransition |
|||
? secondaryRouteAnimation |
|||
: new CurvedAnimation( |
|||
parent: secondaryRouteAnimation, |
|||
curve: Curves.linearToEaseOut, |
|||
reverseCurve: Curves.easeInToLinear |
|||
) |
|||
).drive(CupertinoRouteUtils._kMiddleLeftTween); |
|||
this._primaryShadowAnimation = |
|||
(linearTransition |
|||
? primaryRouteAnimation |
|||
: new CurvedAnimation( |
|||
parent: primaryRouteAnimation, |
|||
curve: Curves.linearToEaseOut |
|||
) |
|||
).drive(CupertinoRouteUtils._kGradientShadowTween); |
|||
this.child = child; |
|||
} |
|||
|
|||
public readonly Animation<Offset> _primaryPositionAnimation; |
|||
|
|||
public readonly Animation<Offset> _secondaryPositionAnimation; |
|||
public readonly Animation<Decoration> _primaryShadowAnimation; |
|||
|
|||
public readonly Widget child; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
TextDirection textDirection = Directionality.of(context); |
|||
return new SlideTransition( |
|||
position: this._secondaryPositionAnimation, |
|||
textDirection: textDirection, |
|||
transformHitTests: false, |
|||
child: new SlideTransition( |
|||
position: this._primaryPositionAnimation, |
|||
textDirection: textDirection, |
|||
child: new DecoratedBoxTransition( |
|||
decoration: this._primaryShadowAnimation, |
|||
child: this.child |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
class CupertinoFullscreenDialogTransition : StatelessWidget { |
|||
public CupertinoFullscreenDialogTransition( |
|||
Animation<float> animation, |
|||
Widget child, |
|||
Key key = null |
|||
) : base(key: key) { |
|||
this._positionAnimation = new CurvedAnimation( |
|||
parent: animation, |
|||
curve: Curves.linearToEaseOut, |
|||
reverseCurve: Curves.linearToEaseOut.flipped |
|||
).drive(CupertinoRouteUtils._kBottomUpTween); |
|||
this.child = child; |
|||
} |
|||
|
|||
readonly Animation<Offset> _positionAnimation; |
|||
|
|||
public readonly Widget child; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new SlideTransition( |
|||
position: this._positionAnimation, |
|||
child: this.child |
|||
); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoBackGestureDetector : StatefulWidget { |
|||
public _CupertinoBackGestureDetector( |
|||
Widget child, |
|||
ValueGetter<bool> enabledCallback, |
|||
ValueGetter<_CupertinoBackGestureController> onStartPopGesture, |
|||
Key key = null |
|||
) : base(key: key) { |
|||
D.assert(enabledCallback != null); |
|||
D.assert(onStartPopGesture != null); |
|||
D.assert(child != null); |
|||
this.child = child; |
|||
this.enabledCallback = enabledCallback; |
|||
this.onStartPopGesture = onStartPopGesture; |
|||
} |
|||
|
|||
public readonly Widget child; |
|||
|
|||
public readonly ValueGetter<bool> enabledCallback; |
|||
|
|||
public readonly ValueGetter<_CupertinoBackGestureController> onStartPopGesture; |
|||
|
|||
public override State createState() { |
|||
return new _CupertinoBackGestureDetectorState(); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoBackGestureDetectorState : State<_CupertinoBackGestureDetector> { |
|||
_CupertinoBackGestureController _backGestureController; |
|||
HorizontalDragGestureRecognizer _recognizer; |
|||
|
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._recognizer = new HorizontalDragGestureRecognizer(debugOwner: this); |
|||
this._recognizer.onStart = this._handleDragStart; |
|||
this._recognizer.onUpdate = this._handleDragUpdate; |
|||
this._recognizer.onEnd = this._handleDragEnd; |
|||
this._recognizer.onCancel = this._handleDragCancel; |
|||
} |
|||
|
|||
public override void dispose() { |
|||
this._recognizer.dispose(); |
|||
base.dispose(); |
|||
} |
|||
|
|||
void _handleDragStart(DragStartDetails details) { |
|||
D.assert(this.mounted); |
|||
D.assert(this._backGestureController == null); |
|||
this._backGestureController = this.widget.onStartPopGesture(); |
|||
} |
|||
|
|||
void _handleDragUpdate(DragUpdateDetails details) { |
|||
D.assert(this.mounted); |
|||
D.assert(this._backGestureController != null); |
|||
this._backGestureController.dragUpdate( |
|||
this._convertToLogical(details.primaryDelta / this.context.size.width)); |
|||
} |
|||
|
|||
void _handleDragEnd(DragEndDetails details) { |
|||
D.assert(this.mounted); |
|||
D.assert(this._backGestureController != null); |
|||
this._backGestureController.dragEnd( |
|||
this._convertToLogical(details.velocity.pixelsPerSecond.dx / this.context.size.width) ?? 0); |
|||
this._backGestureController = null; |
|||
} |
|||
|
|||
void _handleDragCancel() { |
|||
D.assert(this.mounted); |
|||
this._backGestureController?.dragEnd(0.0f); |
|||
this._backGestureController = null; |
|||
} |
|||
|
|||
void _handlePointerDown(PointerDownEvent evt) { |
|||
if (this.widget.enabledCallback()) { |
|||
this._recognizer.addPointer(evt); |
|||
} |
|||
} |
|||
|
|||
float? _convertToLogical(float? value) { |
|||
switch (Directionality.of(this.context)) { |
|||
case TextDirection.rtl: |
|||
return -value; |
|||
case TextDirection.ltr: |
|||
return value; |
|||
} |
|||
|
|||
return value; |
|||
} |
|||
|
|||
|
|||
public override Widget build(BuildContext context) { |
|||
float dragAreaWidth = Directionality.of(context) == TextDirection.ltr |
|||
? MediaQuery.of(context).padding.left |
|||
: MediaQuery.of(context).padding.right; |
|||
dragAreaWidth = Mathf.Max(dragAreaWidth, CupertinoRouteUtils._kBackGestureWidth); |
|||
return new Stack( |
|||
fit: StackFit.passthrough, |
|||
children: new List<Widget> { |
|||
this.widget.child, |
|||
new Positioned( |
|||
left: 0.0f, |
|||
width: dragAreaWidth, |
|||
top: 0.0f, |
|||
bottom: 0.0f, |
|||
child: new Listener( |
|||
onPointerDown: this._handlePointerDown, |
|||
behavior: HitTestBehavior.translucent |
|||
) |
|||
) |
|||
} |
|||
); |
|||
} |
|||
} |
|||
|
|||
class _CupertinoBackGestureController { |
|||
public _CupertinoBackGestureController( |
|||
NavigatorState navigator, |
|||
AnimationController controller |
|||
) { |
|||
D.assert(navigator != null); |
|||
D.assert(controller != null); |
|||
|
|||
this.navigator = navigator; |
|||
this.controller = controller; |
|||
this.navigator.didStartUserGesture(); |
|||
} |
|||
|
|||
public readonly AnimationController controller; |
|||
public readonly NavigatorState navigator; |
|||
|
|||
public void dragUpdate(float? delta) { |
|||
if (delta != null) { |
|||
this.controller.setValue(this.controller.value - (float) delta); |
|||
} |
|||
} |
|||
|
|||
public void dragEnd(float velocity) { |
|||
Curve animationCurve = Curves.fastLinearToSlowEaseIn; |
|||
bool animateForward; |
|||
|
|||
if (velocity.abs() >= CupertinoRouteUtils._kMinFlingVelocity) { |
|||
animateForward = velocity > 0 ? false : true; |
|||
} |
|||
else { |
|||
animateForward = this.controller.value > 0.5 ? true : false; |
|||
} |
|||
|
|||
if (animateForward) { |
|||
int droppedPageForwardAnimationTime = Mathf.Min( |
|||
MathUtils.lerpFloat(CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime, 0f, |
|||
this.controller.value).floor(), |
|||
CupertinoRouteUtils._kMaxPageBackAnimationTime |
|||
); |
|||
this.controller.animateTo(1.0f, duration: new TimeSpan(0, 0, 0, 0, droppedPageForwardAnimationTime), |
|||
curve: animationCurve); |
|||
} |
|||
else { |
|||
this.navigator.pop(); |
|||
|
|||
if (this.controller.isAnimating) { |
|||
int droppedPageBackAnimationTime = |
|||
MathUtils.lerpFloat(0f, CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime, |
|||
this.controller.value).floor(); |
|||
this.controller.animateBack(0.0f, duration: new TimeSpan(0, 0, 0, 0, droppedPageBackAnimationTime), |
|||
curve: animationCurve); |
|||
} |
|||
} |
|||
|
|||
if (this.controller.isAnimating) { |
|||
AnimationStatusListener animationStatusCallback = null; |
|||
animationStatusCallback = (AnimationStatus status) => { |
|||
this.navigator.didStopUserGesture(); |
|||
this.controller.removeStatusListener(animationStatusCallback); |
|||
}; |
|||
this.controller.addStatusListener(animationStatusCallback); |
|||
} |
|||
else { |
|||
this.navigator.didStopUserGesture(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class _CupertinoModalPopupRoute : PopupRoute { |
|||
public _CupertinoModalPopupRoute( |
|||
WidgetBuilder builder = null, |
|||
string barrierLabel = null, |
|||
RouteSettings settings = null |
|||
) : base(settings: settings) { |
|||
this.builder = builder; |
|||
this.barrierLabel = barrierLabel; |
|||
} |
|||
|
|||
public readonly WidgetBuilder builder; |
|||
|
|||
public readonly string barrierLabel; |
|||
|
|||
|
|||
public override Color barrierColor { |
|||
get { return CupertinoRouteUtils._kModalBarrierColor; } |
|||
} |
|||
|
|||
public override bool barrierDismissible { |
|||
get { return true; } |
|||
} |
|||
|
|||
public bool semanticsDismissible { |
|||
get { return false; } |
|||
} |
|||
|
|||
public override TimeSpan transitionDuration { |
|||
get { return CupertinoRouteUtils._kModalPopupTransitionDuration; } |
|||
} |
|||
|
|||
Animation<float> _animation; |
|||
|
|||
Tween<Offset> _offsetTween; |
|||
|
|||
|
|||
public override Animation<float> createAnimation() { |
|||
D.assert(this._animation == null); |
|||
this._animation = new CurvedAnimation( |
|||
parent: base.createAnimation(), |
|||
curve: Curves.linearToEaseOut, |
|||
reverseCurve: Curves.linearToEaseOut.flipped |
|||
); |
|||
this._offsetTween = new OffsetTween( |
|||
begin: new Offset(0.0f, 1.0f), |
|||
end: new Offset(0.0f, 0.0f) |
|||
); |
|||
return this._animation; |
|||
} |
|||
|
|||
|
|||
public override Widget buildPage(BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation) { |
|||
return this.builder(context); |
|||
} |
|||
|
|||
|
|||
public override Widget buildTransitions(BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation, Widget child) { |
|||
return new Align( |
|||
alignment: Alignment.bottomCenter, |
|||
child: new FractionalTranslation( |
|||
translation: this._offsetTween.evaluate(this._animation), |
|||
child: child |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8be76856222d049f6a345e650f6484ab |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
static class CupertinoTextThemeDataUtils { |
|||
public static readonly TextStyle _kDefaultLightTextStyle = new TextStyle( |
|||
inherit: false, |
|||
fontFamily: ".SF Pro Text", |
|||
fontSize: 17.0f, |
|||
letterSpacing: -0.41f, |
|||
color: CupertinoColors.black, |
|||
decoration: TextDecoration.none |
|||
); |
|||
|
|||
public static readonly TextStyle _kDefaultDarkTextStyle = new TextStyle( |
|||
inherit: false, |
|||
fontFamily: ".SF Pro Text", |
|||
fontSize: 17.0f, |
|||
letterSpacing: -0.41f, |
|||
color: CupertinoColors.white, |
|||
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 _kDefaultMiddleTitleLightTextStyle = new TextStyle( |
|||
inherit: false, |
|||
fontFamily: ".SF Pro Text", |
|||
fontSize: 17.0f, |
|||
fontWeight: FontWeight.w600, |
|||
letterSpacing: -0.41f, |
|||
color: CupertinoColors.black |
|||
); |
|||
|
|||
public static readonly TextStyle _kDefaultMiddleTitleDarkTextStyle = new TextStyle( |
|||
inherit: false, |
|||
fontFamily: ".SF Pro Text", |
|||
fontSize: 17.0f, |
|||
fontWeight: FontWeight.w600, |
|||
letterSpacing: -0.41f, |
|||
color: CupertinoColors.white |
|||
); |
|||
|
|||
public static readonly TextStyle _kDefaultLargeTitleLightTextStyle = new TextStyle( |
|||
inherit: false, |
|||
fontFamily: ".SF Pro Display", |
|||
fontSize: 34.0f, |
|||
fontWeight: FontWeight.w700, |
|||
letterSpacing: 0.41f, |
|||
color: CupertinoColors.black |
|||
); |
|||
|
|||
public static readonly TextStyle _kDefaultLargeTitleDarkTextStyle = new TextStyle( |
|||
inherit: false, |
|||
fontFamily: ".SF Pro Display", |
|||
fontSize: 34.0f, |
|||
fontWeight: FontWeight.w700, |
|||
letterSpacing: 0.41f, |
|||
color: CupertinoColors.white |
|||
); |
|||
} |
|||
|
|||
|
|||
public class CupertinoTextThemeData : Diagnosticable { |
|||
public CupertinoTextThemeData( |
|||
Color primaryColor = null, |
|||
Brightness? brightness = null, |
|||
TextStyle textStyle = null, |
|||
TextStyle actionTextStyle = null, |
|||
TextStyle tabLabelTextStyle = null, |
|||
TextStyle navTitleTextStyle = null, |
|||
TextStyle navLargeTitleTextStyle = null, |
|||
TextStyle navActionTextStyle = null |
|||
) { |
|||
this._primaryColor = primaryColor ?? CupertinoColors.activeBlue; |
|||
this._brightness = brightness; |
|||
this._textStyle = textStyle; |
|||
this._actionTextStyle = actionTextStyle; |
|||
this._tabLabelTextStyle = tabLabelTextStyle; |
|||
this._navTitleTextStyle = navTitleTextStyle; |
|||
this._navLargeTitleTextStyle = navLargeTitleTextStyle; |
|||
this._navActionTextStyle = navActionTextStyle; |
|||
} |
|||
|
|||
readonly Color _primaryColor; |
|||
readonly Brightness? _brightness; |
|||
|
|||
bool _isLight { |
|||
get { return this._brightness != Brightness.dark; } |
|||
} |
|||
|
|||
readonly TextStyle _textStyle; |
|||
|
|||
public TextStyle textStyle { |
|||
get { |
|||
return this._textStyle ?? (this._isLight |
|||
? CupertinoTextThemeDataUtils._kDefaultLightTextStyle |
|||
: CupertinoTextThemeDataUtils._kDefaultDarkTextStyle); |
|||
} |
|||
} |
|||
|
|||
readonly TextStyle _actionTextStyle; |
|||
|
|||
public TextStyle actionTextStyle { |
|||
get { |
|||
return this._actionTextStyle ?? CupertinoTextThemeDataUtils._kDefaultActionTextStyle.copyWith( |
|||
color: this._primaryColor |
|||
); |
|||
} |
|||
} |
|||
|
|||
readonly TextStyle _tabLabelTextStyle; |
|||
|
|||
public TextStyle tabLabelTextStyle { |
|||
get { return this._tabLabelTextStyle ?? CupertinoTextThemeDataUtils._kDefaultTabLabelTextStyle; } |
|||
} |
|||
|
|||
readonly TextStyle _navTitleTextStyle; |
|||
|
|||
TextStyle navTitleTextStyle { |
|||
get { |
|||
return this._navTitleTextStyle ?? |
|||
(this._isLight |
|||
? CupertinoTextThemeDataUtils._kDefaultMiddleTitleLightTextStyle |
|||
: CupertinoTextThemeDataUtils._kDefaultMiddleTitleDarkTextStyle); |
|||
} |
|||
} |
|||
|
|||
readonly TextStyle _navLargeTitleTextStyle; |
|||
|
|||
/// Typography of large titles in sliver navigation bars.
|
|||
public TextStyle navLargeTitleTextStyle { |
|||
get { |
|||
return this._navLargeTitleTextStyle ?? |
|||
(this._isLight |
|||
? CupertinoTextThemeDataUtils._kDefaultLargeTitleLightTextStyle |
|||
: CupertinoTextThemeDataUtils._kDefaultLargeTitleDarkTextStyle); |
|||
} |
|||
} |
|||
|
|||
readonly TextStyle _navActionTextStyle; |
|||
|
|||
public TextStyle navActionTextStyle { |
|||
get { |
|||
return this._navActionTextStyle ?? CupertinoTextThemeDataUtils._kDefaultActionTextStyle.copyWith( |
|||
color: this._primaryColor |
|||
); |
|||
} |
|||
} |
|||
|
|||
public CupertinoTextThemeData copyWith( |
|||
Color primaryColor, |
|||
Brightness? brightness, |
|||
TextStyle textStyle, |
|||
TextStyle actionTextStyle, |
|||
TextStyle tabLabelTextStyle, |
|||
TextStyle navTitleTextStyle, |
|||
TextStyle navLargeTitleTextStyle, |
|||
TextStyle navActionTextStyle |
|||
) { |
|||
return new CupertinoTextThemeData( |
|||
primaryColor: primaryColor ?? this._primaryColor, |
|||
brightness: brightness ?? this._brightness, |
|||
textStyle: textStyle ?? this._textStyle, |
|||
actionTextStyle: actionTextStyle ?? this._actionTextStyle, |
|||
tabLabelTextStyle: tabLabelTextStyle ?? this._tabLabelTextStyle, |
|||
navTitleTextStyle: navTitleTextStyle ?? this._navTitleTextStyle, |
|||
navLargeTitleTextStyle: navLargeTitleTextStyle ?? this._navLargeTitleTextStyle, |
|||
navActionTextStyle: navActionTextStyle ?? this._navActionTextStyle |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: df4b7fd7cba7a412f9904c599a8e2ae5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.cupertino { |
|||
static class CupertinoThemeDataUtils { |
|||
public static readonly Color _kDefaultBarLightBackgroundColor = new Color(0xCCF8F8F8); |
|||
public static readonly Color _kDefaultBarDarkBackgroundColor = new Color(0xB7212121); |
|||
} |
|||
|
|||
class CupertinoTheme : StatelessWidget { |
|||
public CupertinoTheme( |
|||
CupertinoThemeData data, |
|||
Widget child, |
|||
Key key = null |
|||
) : base(key: key) { |
|||
D.assert(child != null); |
|||
D.assert(data != null); |
|||
this.data = data; |
|||
this.child = child; |
|||
} |
|||
|
|||
public readonly CupertinoThemeData data; |
|||
|
|||
public readonly Widget child; |
|||
|
|||
public static CupertinoThemeData of(BuildContext context) { |
|||
_InheritedCupertinoTheme inheritedTheme = |
|||
(_InheritedCupertinoTheme) context.inheritFromWidgetOfExactType(typeof(_InheritedCupertinoTheme)); |
|||
return inheritedTheme?.theme?.data ?? new CupertinoThemeData(); |
|||
} |
|||
|
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new _InheritedCupertinoTheme( |
|||
theme: this, |
|||
child: new IconTheme( |
|||
data: new IconThemeData(color: this.data.primaryColor), |
|||
child: this.child |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
class _InheritedCupertinoTheme : InheritedWidget { |
|||
public _InheritedCupertinoTheme( |
|||
CupertinoTheme theme, |
|||
Widget child, |
|||
Key key = null |
|||
) |
|||
: base(key: key, child: child) { |
|||
D.assert(theme != null); |
|||
this.theme = theme; |
|||
} |
|||
|
|||
public readonly CupertinoTheme theme; |
|||
|
|||
public override bool updateShouldNotify(InheritedWidget old) { |
|||
return this.theme.data != ((_InheritedCupertinoTheme) old).theme.data; |
|||
} |
|||
} |
|||
|
|||
public class CupertinoThemeData : Diagnosticable { |
|||
public CupertinoThemeData( |
|||
Brightness? brightness = null, |
|||
Color primaryColor = null, |
|||
Color primaryContrastingColor = null, |
|||
CupertinoTextThemeData textTheme = null, |
|||
Color barBackgroundColor = null, |
|||
Color scaffoldBackgroundColor = null |
|||
) { |
|||
this._brightness = brightness; |
|||
this._primaryColor = primaryColor; |
|||
this._primaryContrastingColor = primaryContrastingColor; |
|||
this._textTheme = textTheme; |
|||
this._barBackgroundColor = barBackgroundColor; |
|||
this._scaffoldBackgroundColor = scaffoldBackgroundColor; |
|||
} |
|||
|
|||
public static CupertinoThemeData raw( |
|||
Brightness? brightness = null, |
|||
Color primaryColor = null, |
|||
Color primaryContrastingColor = null, |
|||
CupertinoTextThemeData textTheme = null, |
|||
Color barBackgroundColor = null, |
|||
Color scaffoldBackgroundColor = null |
|||
) { |
|||
D.assert(brightness != null); |
|||
D.assert(primaryColor != null); |
|||
D.assert(primaryContrastingColor != null); |
|||
D.assert(textTheme != null); |
|||
D.assert(barBackgroundColor != null); |
|||
D.assert(scaffoldBackgroundColor != null); |
|||
return new CupertinoThemeData( |
|||
brightness: brightness, |
|||
primaryColor: primaryColor, |
|||
primaryContrastingColor: primaryContrastingColor, |
|||
textTheme: textTheme, |
|||
barBackgroundColor: barBackgroundColor, |
|||
scaffoldBackgroundColor: scaffoldBackgroundColor |
|||
); |
|||
} |
|||
|
|||
bool _isLight { |
|||
get { return this.brightness == Brightness.light; } |
|||
} |
|||
|
|||
public Brightness brightness { |
|||
get { return this._brightness ?? Brightness.light; } |
|||
} |
|||
|
|||
readonly Brightness? _brightness; |
|||
|
|||
public Color primaryColor { |
|||
get { |
|||
return this._primaryColor ?? |
|||
(this._isLight ? CupertinoColors.activeBlue : CupertinoColors.activeOrange); |
|||
} |
|||
} |
|||
|
|||
readonly Color _primaryColor; |
|||
|
|||
public Color primaryContrastingColor { |
|||
get { |
|||
return this._primaryContrastingColor ?? |
|||
(this._isLight ? CupertinoColors.white : CupertinoColors.black); |
|||
} |
|||
} |
|||
|
|||
readonly Color _primaryContrastingColor; |
|||
|
|||
public CupertinoTextThemeData textTheme { |
|||
get { |
|||
return this._textTheme ?? new CupertinoTextThemeData( |
|||
brightness: this.brightness, |
|||
primaryColor: this.primaryColor |
|||
); |
|||
} |
|||
} |
|||
|
|||
readonly CupertinoTextThemeData _textTheme; |
|||
|
|||
public Color barBackgroundColor { |
|||
get { |
|||
return this._barBackgroundColor ?? |
|||
(this._isLight |
|||
? CupertinoThemeDataUtils._kDefaultBarLightBackgroundColor |
|||
: CupertinoThemeDataUtils._kDefaultBarDarkBackgroundColor); |
|||
} |
|||
} |
|||
|
|||
readonly Color _barBackgroundColor; |
|||
|
|||
public Color scaffoldBackgroundColor { |
|||
get { |
|||
return this._scaffoldBackgroundColor ?? |
|||
(this._isLight ? CupertinoColors.white : CupertinoColors.black); |
|||
} |
|||
} |
|||
|
|||
readonly Color _scaffoldBackgroundColor; |
|||
|
|||
public CupertinoThemeData noDefault() { |
|||
return new _NoDefaultCupertinoThemeData( |
|||
this._brightness, |
|||
this._primaryColor, |
|||
this._primaryContrastingColor, |
|||
this._textTheme, |
|||
this._barBackgroundColor, |
|||
this._scaffoldBackgroundColor |
|||
); |
|||
} |
|||
|
|||
public CupertinoThemeData copyWith( |
|||
Brightness? brightness, |
|||
Color primaryColor, |
|||
Color primaryContrastingColor, |
|||
CupertinoTextThemeData textTheme, |
|||
Color barBackgroundColor, |
|||
Color scaffoldBackgroundColor |
|||
) { |
|||
return new CupertinoThemeData( |
|||
brightness: brightness ?? this._brightness, |
|||
primaryColor: primaryColor ?? this._primaryColor, |
|||
primaryContrastingColor: primaryContrastingColor ?? this._primaryContrastingColor, |
|||
textTheme: textTheme ?? this._textTheme, |
|||
barBackgroundColor: barBackgroundColor ?? this._barBackgroundColor, |
|||
scaffoldBackgroundColor: scaffoldBackgroundColor ?? this._scaffoldBackgroundColor |
|||
); |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
CupertinoThemeData defaultData = new CupertinoThemeData(); |
|||
properties.add( |
|||
new EnumProperty<Brightness>("brightness", this.brightness, defaultValue: defaultData.brightness)); |
|||
properties.add(new DiagnosticsProperty<Color>("primaryColor", this.primaryColor, |
|||
defaultValue: defaultData.primaryColor)); |
|||
properties.add(new DiagnosticsProperty<Color>("primaryContrastingColor", this.primaryContrastingColor, |
|||
defaultValue: defaultData.primaryContrastingColor)); |
|||
properties.add( |
|||
new DiagnosticsProperty<CupertinoTextThemeData>("textTheme", this.textTheme, |
|||
defaultValue: defaultData.textTheme)); |
|||
properties.add(new DiagnosticsProperty<Color>("barBackgroundColor", this.barBackgroundColor, |
|||
defaultValue: defaultData.barBackgroundColor)); |
|||
properties.add(new DiagnosticsProperty<Color>("scaffoldBackgroundColor", this.scaffoldBackgroundColor, |
|||
defaultValue: defaultData.scaffoldBackgroundColor)); |
|||
} |
|||
} |
|||
|
|||
class _NoDefaultCupertinoThemeData : CupertinoThemeData { |
|||
public _NoDefaultCupertinoThemeData( |
|||
Brightness? brightness, |
|||
Color primaryColor, |
|||
Color primaryContrastingColor, |
|||
CupertinoTextThemeData textTheme, |
|||
Color barBackgroundColor, |
|||
Color scaffoldBackgroundColor |
|||
) { |
|||
this.brightness = brightness; |
|||
this.primaryColor = primaryColor; |
|||
this.primaryContrastingColor = primaryContrastingColor; |
|||
this.textTheme = textTheme; |
|||
this.barBackgroundColor = barBackgroundColor; |
|||
this.scaffoldBackgroundColor = scaffoldBackgroundColor; |
|||
} |
|||
|
|||
public new readonly Brightness? brightness; |
|||
|
|||
public new readonly Color primaryColor; |
|||
|
|||
public new readonly Color primaryContrastingColor; |
|||
|
|||
public new readonly CupertinoTextThemeData textTheme; |
|||
|
|||
public new readonly Color barBackgroundColor; |
|||
|
|||
public new readonly Color scaffoldBackgroundColor; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3ecd7071d542a4449a9f653bde26fbd9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue