import 'package:flutter/cupertino.dart'; import 'package:please_pay_me/theme/theme.dart'; import 'package:please_pay_me/ui/ui.dart'; import 'package:please_pay_me_widgetbook/knobs/common_knobs.dart'; import 'package:please_pay_me_widgetbook/support/preview.dart'; import 'package:widgetbook/widgetbook.dart'; WidgetbookComponent switchesComponent() { return WidgetbookComponent( name: 'AppSwitchRow', useCases: [ WidgetbookUseCase( name: 'Playground', builder: (context) { final subtitle = knobText(context, label: 'Subtitle', initialValue: ''); return IosPreview( stretch: true, child: AppListSection( separatorIndent: 60, children: [ AppSwitchRow( leading: knobBool(context, label: 'Leading badge', initialValue: true) ? const AppIconBadge( icon: CupertinoIcons.bell_fill, color: AppColors.systemRed, ) : null, title: knobText(context, label: 'Title', initialValue: 'Уведомления'), subtitle: subtitle.isEmpty ? null : subtitle, value: knobBool(context, label: 'Value', initialValue: true), onChanged: knobBool(context, label: 'Enabled', initialValue: true) ? (_) {} : null, ), ], ), ); }, ), WidgetbookUseCase( name: 'Settings group', builder: (context) { return IosPreview( stretch: true, child: AppListSection( header: 'Настройки', footer: 'Push приходят за час до дедлайна бюджета.', separatorIndent: 60, children: [ AppSwitchRow( leading: const AppIconBadge( icon: CupertinoIcons.bell_fill, color: AppColors.systemRed, ), title: 'Уведомления', value: true, onChanged: (_) {}, ), AppSwitchRow( leading: const AppIconBadge( icon: CupertinoIcons.lock_fill, color: AppColors.systemGray, ), title: 'Face ID', value: false, onChanged: (_) {}, ), ], ), ); }, ), ], ); }