feat: 添加自动化任务(automation_jobs)功能模块
This commit is contained in:
@@ -6,7 +6,7 @@ class AppToggleSwitch extends StatelessWidget {
|
||||
const AppToggleSwitch({
|
||||
super.key,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
this.onChanged,
|
||||
this.activeBackgroundColor,
|
||||
this.inactiveBackgroundColor,
|
||||
this.activeBorderColor,
|
||||
@@ -14,7 +14,7 @@ class AppToggleSwitch extends StatelessWidget {
|
||||
});
|
||||
|
||||
final bool value;
|
||||
final ValueChanged<bool> onChanged;
|
||||
final ValueChanged<bool>? onChanged;
|
||||
final Color? activeBackgroundColor;
|
||||
final Color? inactiveBackgroundColor;
|
||||
final Color? activeBorderColor;
|
||||
@@ -23,32 +23,35 @@ class AppToggleSwitch extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => onChanged(!value),
|
||||
child: Container(
|
||||
width: AppSpacing.xxl + AppSpacing.xl,
|
||||
height: AppSpacing.xl + AppSpacing.xs,
|
||||
padding: const EdgeInsets.all(AppSpacing.xs / 2),
|
||||
decoration: BoxDecoration(
|
||||
color: value
|
||||
? (activeBackgroundColor ?? AppColors.blue100)
|
||||
: (inactiveBackgroundColor ?? AppColors.surfaceTertiary),
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
border: Border.all(
|
||||
onTap: onChanged == null ? null : () => onChanged!(!value),
|
||||
child: Opacity(
|
||||
opacity: onChanged == null ? 0.55 : 1,
|
||||
child: Container(
|
||||
width: AppSpacing.xxl + AppSpacing.xl,
|
||||
height: AppSpacing.xl + AppSpacing.xs,
|
||||
padding: const EdgeInsets.all(AppSpacing.xs / 2),
|
||||
decoration: BoxDecoration(
|
||||
color: value
|
||||
? (activeBorderColor ?? AppColors.blue300)
|
||||
: (inactiveBorderColor ?? AppColors.borderSecondary),
|
||||
? (activeBackgroundColor ?? AppColors.blue100)
|
||||
: (inactiveBackgroundColor ?? AppColors.surfaceTertiary),
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
border: Border.all(
|
||||
color: value
|
||||
? (activeBorderColor ?? AppColors.blue300)
|
||||
: (inactiveBorderColor ?? AppColors.borderSecondary),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: AnimatedAlign(
|
||||
duration: const Duration(milliseconds: 150),
|
||||
alignment: value ? Alignment.centerRight : Alignment.centerLeft,
|
||||
child: Container(
|
||||
width: AppSpacing.lg + AppSpacing.xs,
|
||||
height: AppSpacing.lg + AppSpacing.xs,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
child: AnimatedAlign(
|
||||
duration: const Duration(milliseconds: 150),
|
||||
alignment: value ? Alignment.centerRight : Alignment.centerLeft,
|
||||
child: Container(
|
||||
width: AppSpacing.lg + AppSpacing.xs,
|
||||
height: AppSpacing.lg + AppSpacing.xs,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
border: Border.all(color: AppColors.borderSecondary),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user