浏览代码

fix two errors(dropdown list & checkbox)

/zgh-devtools
guanghuispark 4 年前
当前提交
d35db49e
共有 3 个文件被更改,包括 70 次插入5 次删除
  1. 4
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/selection_controls_demo.cs
  2. 2
      com.unity.uiwidgets/Runtime/material/navigation_rail_theme.cs
  3. 69
      com.unity.uiwidgets/Runtime/material/theme_data.cs

4
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/selection_controls_demo.cs


private bool checkboxValueA = true;
private bool checkboxValueB = false;
private bool checkboxValueC;
private bool? checkboxValueC;
private int radioValue = 0;
private bool switchValue = false;

new Checkbox(
value: checkboxValueC,
tristate: true,
onChanged: (bool? value) => { setState(() => { checkboxValueC = value == null? false: value.Value; }); }
onChanged: (bool? value) => { setState(() => { checkboxValueC = value; }); }
)
}
),

2
com.unity.uiwidgets/Runtime/material/navigation_rail_theme.cs


);
}
static NavigationRailThemeData lerp(NavigationRailThemeData a, NavigationRailThemeData b, float t) {
public static NavigationRailThemeData lerp(NavigationRailThemeData a, NavigationRailThemeData b, float t) {
if (a == null && b == null)
return null;
return new NavigationRailThemeData(

69
com.unity.uiwidgets/Runtime/material/theme_data.cs


using System.Collections.Generic;
using System.Linq;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

Color bottomAppBarColor = null,
Color cardColor = null,
Color dividerColor = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
InteractiveInkFeatureFactory splashFactory = null,

Color buttonColor = null,
ButtonThemeData buttonTheme = null,
ToggleButtonsThemeData toggleButtonsTheme = null,
Color secondaryHeaderColor = null,
Color textSelectionColor = null,
Color cursorColor = null,

IconThemeData accentIconTheme = null,
SliderThemeData sliderTheme = null,
TabBarTheme tabBarTheme = null,
TooltipThemeData tooltipTheme = null,
CardTheme cardTheme = null,
ChipThemeData chipTheme = null,
RuntimePlatform? platform = null,

ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
FloatingActionButtonThemeData floatingActionButtonTheme = null,
NavigationRailThemeData navigationRailTheme = null,
Typography typography = null,
SnackBarThemeData snackBarTheme = null,
BottomSheetThemeData bottomSheetTheme = null,

}
buttonColor = buttonColor ?? (isDark ? primarySwatch[600] : Colors.grey[300]);
focusColor = focusColor ??(isDark ? Colors.white.withOpacity(0.12f) : Colors.black.withOpacity(0.12f));
hoverColor = hoverColor ??(isDark ? Colors.white.withOpacity(0.04f) : Colors.black.withOpacity(0.04f));
focusColor: focusColor,
hoverColor: hoverColor,
disabledColor = disabledColor ?? (isDark ? Colors.white30 : Colors.black38);
toggleButtonsTheme = toggleButtonsTheme?? new ToggleButtonsThemeData();
disabledColor = disabledColor ?? (isDark ? Colors.white38 : Colors.black38);
highlightColor = highlightColor ??
(isDark
? material_._kDarkThemeHighlightColor

valueIndicatorTextStyle: accentTextTheme.body2);
tabBarTheme = tabBarTheme ?? new TabBarTheme();
tooltipTheme = tooltipTheme ?? new TooltipThemeData();
labelStyle: textTheme.body2
labelStyle: textTheme.bodyText1
navigationRailTheme = navigationRailTheme ?? new NavigationRailThemeData();
snackBarTheme = snackBarTheme ?? new SnackBarThemeData();
bottomSheetTheme = bottomSheetTheme ?? new BottomSheetThemeData();
popupMenuTheme = popupMenuTheme ?? new PopupMenuThemeData();

this.bottomAppBarColor = bottomAppBarColor;
this.cardColor = cardColor;
this.dividerColor = dividerColor;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.highlightColor = highlightColor;
this.splashColor = splashColor;
this.splashFactory = splashFactory;

this.buttonTheme = buttonTheme;
this.toggleButtonsTheme = toggleButtonsTheme;
this.buttonColor = buttonColor;
this.secondaryHeaderColor = secondaryHeaderColor;
this.textSelectionColor = textSelectionColor;

this.accentIconTheme = accentIconTheme;
this.sliderTheme = sliderTheme;
this.tabBarTheme = tabBarTheme;
this.tooltipTheme = tooltipTheme;
this.cardTheme = cardTheme;
this.chipTheme = chipTheme;
this.platform = platform.Value;

this.colorScheme = colorScheme;
this.dialogTheme = dialogTheme;
this.floatingActionButtonTheme = floatingActionButtonTheme;
this.navigationRailTheme = navigationRailTheme;
this.typography = typography;
this.snackBarTheme = snackBarTheme;
this.bottomSheetTheme = bottomSheetTheme;

Color bottomAppBarColor = null,
Color cardColor = null,
Color dividerColor = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
InteractiveInkFeatureFactory splashFactory = null,

ButtonThemeData buttonTheme = null,
Color buttonColor = null,
ToggleButtonsThemeData toggleButtonsTheme = null,
Color secondaryHeaderColor = null,
Color textSelectionColor = null,
Color cursorColor = null,

IconThemeData primaryIconTheme = null,
IconThemeData accentIconTheme = null,
TabBarTheme tabBarTheme = null,
TooltipThemeData tooltipTheme = null,
CardTheme cardTheme = null,
ChipThemeData chipTheme = null,
RuntimePlatform? platform = null,

ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
FloatingActionButtonThemeData floatingActionButtonTheme = null,
NavigationRailThemeData navigationRailTheme = null,
Typography typography = null,
SnackBarThemeData snackBarTheme = null,
BottomSheetThemeData bottomSheetTheme = null,

D.assert(bottomAppBarColor != null);
D.assert(cardColor != null);
D.assert(dividerColor != null);
D.assert(focusColor != null);
D.assert(hoverColor != null);
D.assert(highlightColor != null);
D.assert(splashColor != null);
D.assert(splashFactory != null);

D.assert(toggleableActiveColor != null);
D.assert(buttonTheme != null);
D.assert(toggleButtonsTheme != null);
D.assert(secondaryHeaderColor != null);
D.assert(textSelectionColor != null);
D.assert(cursorColor != null);

D.assert(typography != null);
D.assert(buttonColor != null);
D.assert(tabBarTheme != null);
D.assert(tooltipTheme != null);
D.assert(navigationRailTheme != null);
D.assert(snackBarTheme != null);
D.assert(bottomSheetTheme != null);
D.assert(popupMenuTheme != null);

return new ThemeData(
brightness: brightness,
visualDensity: visualDensity,
primaryColor: primaryColor,
primaryColorBrightness: primaryColorBrightness,
primaryColorLight: primaryColorLight,

bottomAppBarColor: bottomAppBarColor,
cardColor: cardColor,
dividerColor: dividerColor,
focusColor: focusColor,
hoverColor: hoverColor,
highlightColor: highlightColor,
splashColor: splashColor,
splashFactory: splashFactory,

buttonTheme: buttonTheme,
buttonColor: buttonColor,
toggleButtonsTheme: toggleButtonsTheme,
toggleableActiveColor: toggleableActiveColor,
secondaryHeaderColor: secondaryHeaderColor,
textSelectionColor: textSelectionColor,

accentIconTheme: accentIconTheme,
sliderTheme: sliderTheme,
tabBarTheme: tabBarTheme,
tooltipTheme:tooltipTheme,
cardTheme: cardTheme,
chipTheme: chipTheme,
platform: platform,

colorScheme: colorScheme,
dialogTheme: dialogTheme,
floatingActionButtonTheme: floatingActionButtonTheme,
navigationRailTheme: navigationRailTheme,
typography: typography,
snackBarTheme: snackBarTheme,
bottomSheetTheme: bottomSheetTheme,

Color bottomAppBarColor = null,
Color cardColor = null,
Color dividerColor = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
InteractiveInkFeatureFactory splashFactory = null,

ButtonThemeData buttonTheme = null,
ToggleButtonsThemeData toggleButtonsTheme = null,
Color buttonColor = null,
Color secondaryHeaderColor = null,
Color textSelectionColor = null,

IconThemeData primaryIconTheme = null,
IconThemeData accentIconTheme = null,
TabBarTheme tabBarTheme = null,
TooltipThemeData tooltipTheme = null,
CardTheme cardTheme = null,
ChipThemeData chipTheme = null,
RuntimePlatform? platform = null,

ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
FloatingActionButtonThemeData floatingActionButtonTheme = null,
NavigationRailThemeData navigationRailTheme = null,
Typography typography = null,
SnackBarThemeData snackBarTheme = null,
BottomSheetThemeData bottomSheetTheme = null,

bottomAppBarColor: bottomAppBarColor ?? this.bottomAppBarColor,
cardColor: cardColor ?? this.cardColor,
dividerColor: dividerColor ?? this.dividerColor,
focusColor: focusColor ?? this.focusColor,
hoverColor: hoverColor ?? this.hoverColor,
highlightColor: highlightColor ?? this.highlightColor,
splashColor: splashColor ?? this.splashColor,
splashFactory: splashFactory ?? this.splashFactory,

buttonTheme: buttonTheme ?? this.buttonTheme,
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
buttonColor: buttonColor ?? this.buttonColor,
secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
textSelectionColor: textSelectionColor ?? this.textSelectionColor,

primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme,
accentIconTheme: accentIconTheme ?? this.accentIconTheme,
tabBarTheme: tabBarTheme ?? this.tabBarTheme,
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
cardTheme: cardTheme ?? this.cardTheme,
chipTheme: chipTheme ?? this.chipTheme,
platform: platform ?? this.platform,

colorScheme: colorScheme ?? this.colorScheme,
dialogTheme: dialogTheme ?? this.dialogTheme,
floatingActionButtonTheme: floatingActionButtonTheme ?? this.floatingActionButtonTheme,
navigationRailTheme: navigationRailTheme ?? this.navigationRailTheme,
typography: typography ?? this.typography,
snackBarTheme: snackBarTheme ?? this.snackBarTheme,
bottomSheetTheme: bottomSheetTheme ?? this.bottomSheetTheme,

bottomAppBarColor: Color.lerp(a.bottomAppBarColor, b.bottomAppBarColor, t),
cardColor: Color.lerp(a.cardColor, b.cardColor, t),
dividerColor: Color.lerp(a.dividerColor, b.dividerColor, t),
focusColor: Color.lerp(a.focusColor, b.focusColor, t),
hoverColor: Color.lerp(a.hoverColor, b.hoverColor, t),
highlightColor: Color.lerp(a.highlightColor, b.highlightColor, t),
splashColor: Color.lerp(a.splashColor, b.splashColor, t),
splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,

buttonTheme: t < 0.5 ? a.buttonTheme : b.buttonTheme,
toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t),
buttonColor: Color.lerp(a.buttonColor, b.buttonColor, t),
secondaryHeaderColor: Color.lerp(a.secondaryHeaderColor, b.secondaryHeaderColor, t),
textSelectionColor: Color.lerp(a.textSelectionColor, b.textSelectionColor, t),

accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t),
sliderTheme: SliderThemeData.lerp(a.sliderTheme, b.sliderTheme, t),
tabBarTheme: TabBarTheme.lerp(a.tabBarTheme, b.tabBarTheme, t),
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t),
cardTheme: CardTheme.lerp(a.cardTheme, b.cardTheme, t),
chipTheme: ChipThemeData.lerp(a.chipTheme, b.chipTheme, t),
platform: t < 0.5 ? a.platform : b.platform,

dialogTheme: DialogTheme.lerp(a.dialogTheme, b.dialogTheme, t),
floatingActionButtonTheme: FloatingActionButtonThemeData.lerp(a.floatingActionButtonTheme,
b.floatingActionButtonTheme, t),
navigationRailTheme: NavigationRailThemeData.lerp(a.navigationRailTheme, b.navigationRailTheme, t),
typography: Typography.lerp(a.typography, b.typography, t),
snackBarTheme: SnackBarThemeData.lerp(a.snackBarTheme, b.snackBarTheme, t),
bottomSheetTheme: BottomSheetThemeData.lerp(a.bottomSheetTheme, b.bottomSheetTheme, t),

other.bottomAppBarColor == bottomAppBarColor &&
other.cardColor == cardColor &&
other.dividerColor == dividerColor &&
other.focusColor == focusColor &&
other.hoverColor == hoverColor &&
other.highlightColor == highlightColor &&
other.splashColor == splashColor &&
other.splashFactory == splashFactory &&

other.buttonTheme == buttonTheme &&
other.toggleButtonsTheme == toggleButtonsTheme &&
other.buttonColor == buttonColor &&
other.secondaryHeaderColor == secondaryHeaderColor &&
other.textSelectionColor == textSelectionColor &&

other.primaryIconTheme == primaryIconTheme &&
other.accentIconTheme == accentIconTheme &&
other.tabBarTheme == tabBarTheme &&
other.tooltipTheme == tooltipTheme &&
other.cardTheme == cardTheme &&
other.chipTheme == chipTheme &&
other.platform == platform &&

other.colorScheme == colorScheme &&
other.dialogTheme == dialogTheme &&
other.floatingActionButtonTheme == floatingActionButtonTheme &&
other.navigationRailTheme == navigationRailTheme &&
other.typography == typography &&
other.snackBarTheme == snackBarTheme &&
other.bottomSheetTheme == bottomSheetTheme &&

hashCode = (hashCode * 397) ^ bottomAppBarColor.GetHashCode();
hashCode = (hashCode * 397) ^ cardColor.GetHashCode();
hashCode = (hashCode * 397) ^ dividerColor.GetHashCode();
hashCode = (hashCode * 397) ^ focusColor.GetHashCode();
hashCode = (hashCode * 397) ^ hoverColor.GetHashCode();
hashCode = (hashCode * 397) ^ highlightColor.GetHashCode();
hashCode = (hashCode * 397) ^ splashColor.GetHashCode();
hashCode = (hashCode * 397) ^ splashFactory.GetHashCode();

hashCode = (hashCode * 397) ^ buttonTheme.GetHashCode();
hashCode = (hashCode * 397) ^ toggleButtonsTheme.GetHashCode();
hashCode = (hashCode * 397) ^ buttonColor.GetHashCode();
hashCode = (hashCode * 397) ^ secondaryHeaderColor.GetHashCode();
hashCode = (hashCode * 397) ^ textSelectionColor.GetHashCode();

hashCode = (hashCode * 397) ^ accentIconTheme.GetHashCode();
hashCode = (hashCode * 397) ^ sliderTheme.GetHashCode();
hashCode = (hashCode * 397) ^ tabBarTheme.GetHashCode();
hashCode = (hashCode * 397) ^ tooltipTheme.GetHashCode();
hashCode = (hashCode * 397) ^ cardTheme.GetHashCode();
hashCode = (hashCode * 397) ^ chipTheme.GetHashCode();
hashCode = (hashCode * 397) ^ platform.GetHashCode();

hashCode = (hashCode * 397) ^ colorScheme.GetHashCode();
hashCode = (hashCode * 397) ^ dialogTheme.GetHashCode();
hashCode = (hashCode * 397) ^ floatingActionButtonTheme.GetHashCode();
hashCode = (hashCode * 397) ^ navigationRailTheme.GetHashCode();
hashCode = (hashCode * 397) ^ typography.GetHashCode();
hashCode = (hashCode * 397) ^ snackBarTheme.GetHashCode();
hashCode = (hashCode * 397) ^ bottomSheetTheme.GetHashCode();

defaultValue: defaultData.cardColor));
properties.add(new DiagnosticsProperty<Color>("dividerColor", dividerColor,
defaultValue: defaultData.dividerColor));
properties.add(new ColorProperty("focusColor", focusColor, defaultValue: defaultData.focusColor, level: DiagnosticLevel.debug));
properties.add(new ColorProperty("hoverColor", hoverColor, defaultValue: defaultData.hoverColor, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Color>("highlightColor", highlightColor,
defaultValue: defaultData.highlightColor));
properties.add(new DiagnosticsProperty<Color>("splashColor", splashColor,

properties.add(new DiagnosticsProperty<Color>("disabledColor", disabledColor,
defaultValue: defaultData.disabledColor));
properties.add(new DiagnosticsProperty<ButtonThemeData>("buttonTheme", buttonTheme));
properties.add(new DiagnosticsProperty<ToggleButtonsThemeData>("toggleButtonsTheme", toggleButtonsTheme, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Color>("buttonColor", buttonColor,
defaultValue: defaultData.buttonColor));
properties.add(new DiagnosticsProperty<Color>("secondaryHeaderColor", secondaryHeaderColor,

properties.add(new DiagnosticsProperty<IconThemeData>("accentIconTheme", accentIconTheme));
properties.add(new DiagnosticsProperty<SliderThemeData>("sliderTheme", sliderTheme));
properties.add(new DiagnosticsProperty<TabBarTheme>("tabBarTheme", tabBarTheme));
properties.add(new DiagnosticsProperty<TooltipThemeData>("tooltipTheme", tooltipTheme, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<CardTheme>("cardTheme", cardTheme));
properties.add(new DiagnosticsProperty<ChipThemeData>("chipTheme", chipTheme));
properties.add(

defaultValue: defaultData.dialogTheme));
properties.add(new DiagnosticsProperty<FloatingActionButtonThemeData>("floatingActionButtonTheme",
floatingActionButtonTheme, defaultValue: defaultData.floatingActionButtonTheme));
properties.add(new DiagnosticsProperty<NavigationRailThemeData>("navigationRailThemeData", navigationRailTheme, defaultValue: defaultData.navigationRailTheme, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Typography>("typography", typography,
defaultValue: defaultData.typography));
properties.add(new DiagnosticsProperty<SnackBarThemeData>("snackBarTheme", snackBarTheme, defaultValue: defaultData.snackBarTheme, level: DiagnosticLevel.debug));

正在加载...
取消
保存