Loading...
Loading...
Compare original and translation side by side
themeMaterialAppThemeDataThemeTheme.of(context).copyWith(...)ThemeDataaccentColorcolorScheme.secondaryaccentTextThemetextThemecolorScheme.onSecondaryAppBarTheme.colorAppBarTheme.backgroundColorMaterialAppthemeThemeDataThemeTheme.of(context).copyWith(...)ThemeDatacolorScheme.secondaryaccentColortextThemecolorScheme.onSecondaryaccentTextThemeAppBarTheme.backgroundColorAppBarTheme.colorColorScheme.fromSeed(seedColor: Colors.blue)ColorScheme.surfaceTintsurfaceTint: Colors.transparentshadowColorletterSpacingTextStyleBottomNavigationBarNavigationBarDrawerNavigationDrawerToggleButtonsSegmentedButtonFilledButtonElevatedButtonColorScheme.fromSeed(seedColor: Colors.blue)ColorScheme.surfaceTintsurfaceTint: Colors.transparentshadowColorTextStyleletterSpacingNavigationBarBottomNavigationBarNavigationDrawerDrawerSegmentedButtonToggleButtonsFilledButtonElevatedButtonThemeData*ThemeData*ThemeThemeData*ThemeDatacardThemeCardThemeDataCardThemedialogThemeDialogThemeDataDialogThemetabBarThemeTabBarThemeDataTabBarThemeappBarThemeAppBarThemeDataAppBarThemebottomAppBarThemeBottomAppBarThemeDataBottomAppBarThemeinputDecorationThemeInputDecorationThemeDataInputDecorationThemeThemeData*ThemeData*ThemeThemeData*ThemeDatacardThemeCardThemeDataCardThemedialogThemeDialogThemeDataDialogThemetabBarThemeTabBarThemeDataTabBarThemeappBarThemeAppBarThemeDataAppBarThemebottomAppBarThemeBottomAppBarThemeDataBottomAppBarThemeinputDecorationThemeInputDecorationThemeDataInputDecorationThemeFlatButtonRaisedButtonOutlineButtonTextButtonElevatedButtonOutlinedButtonButtonStyleTextButton.styleFrom(foregroundColor: Colors.blue)MaterialStateProperty.resolveWithFlatButtonRaisedButtonOutlineButtonTextButtonElevatedButtonOutlinedButtonButtonStyleTextButton.styleFrom(foregroundColor: Colors.blue)MaterialStateProperty.resolveWiththumbVisibilityScrollbarSelectableTextSelectableText.richRowTextDirection.rtlTextDirection.ltrTooltipScrollbarthumbVisibilitySelectableTextSelectableText.richRowTextDirection.rtlTextDirection.ltrTooltipuseMaterial3: falseThemeDataColorSchemeColorScheme.fromSeed()accentColoraccentColorBrightnessaccentIconThemeaccentTextThemeAppBarTheme(color: ...)backgroundColorThemeData*ThemeDatacardTheme: CardThemeData()FlatButtonTextButtonRaisedButtonElevatedButtonOutlineButtonOutlinedButtonBottomNavigationBarNavigationBarDrawerNavigationDrawerThemeDatauseMaterial3: falseColorScheme.fromSeed()ColorSchemeaccentColoraccentColorBrightnessaccentIconThemeaccentTextThemeAppBarTheme(color: ...)backgroundColorThemeData*ThemeDatacardTheme: CardThemeData()FlatButtonTextButtonRaisedButtonElevatedButtonOutlineButtonOutlinedButtonBottomNavigationBarNavigationBarDrawerNavigationDrawerScrollbarthumbVisibility: DeviceType.isDesktopSelectableTextTextTextDirection.rtlRowTooltipScrollbarthumbVisibility: DeviceType.isDesktopSelectableTextTextRowTextDirection.rtlTooltipMaterialApp(
title: 'Adaptive App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: Brightness.light,
),
// Use *ThemeData classes for component normalization
appBarTheme: const AppBarThemeData(
backgroundColor: Colors.deepPurple, // Do not use 'color'
elevation: 0,
),
cardTheme: const CardThemeData(
elevation: 2,
),
textTheme: const TextTheme(
bodyMedium: TextStyle(letterSpacing: 0.2),
),
),
home: const MyHomePage(),
);MaterialApp(
title: 'Adaptive App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: Brightness.light,
),
// 使用*ThemeData类进行组件规范化
appBarTheme: const AppBarThemeData(
backgroundColor: Colors.deepPurple, // 请勿使用'color'
elevation: 0,
),
cardTheme: const CardThemeData(
elevation: 2,
),
textTheme: const TextTheme(
bodyMedium: TextStyle(letterSpacing: 0.2),
),
),
home: const MyHomePage(),
);TextButton(
style: ButtonStyle(
// Default color
foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),
// State-dependent overlay color
overlayColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
return Colors.blue.withOpacity(0.04);
}
if (states.contains(MaterialState.focused) || states.contains(MaterialState.pressed)) {
return Colors.blue.withOpacity(0.12);
}
return null; // Defer to the widget's default.
},
),
),
onPressed: () {},
child: const Text('Adaptive Button'),
)TextButton(
style: ButtonStyle(
// 默认颜色
foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),
// 依赖状态的覆盖色
overlayColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
return Colors.blue.withOpacity(0.04);
}
if (states.contains(MaterialState.focused) || states.contains(MaterialState.pressed)) {
return Colors.blue.withOpacity(0.12);
}
return null; // 遵循组件默认值
},
),
),
onPressed: () {},
child: const Text('Adaptive Button'),
)Row(
// Windows expects confirmation on the left (RTL reverses the standard LTR Row)
textDirection: Platform.isWindows ? TextDirection.rtl : TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Cancel'),
),
FilledButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Confirm'),
),
],
)Row(
// Windows系统期望确认按钮在左侧(RTL会反转标准LTR的Row顺序)
textDirection: Platform.isWindows ? TextDirection.rtl : TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Cancel'),
),
FilledButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Confirm'),
),
],
)