feat(proj): init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
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 avatarsComponent() {
|
||||
return WidgetbookComponent(
|
||||
name: 'AppAvatar',
|
||||
useCases: [
|
||||
WidgetbookUseCase(
|
||||
name: 'Playground',
|
||||
builder: (context) {
|
||||
final initials = knobText(context, label: 'Initials', initialValue: 'ВА');
|
||||
return IosPreview.centered(
|
||||
child: AppAvatar(
|
||||
initials: knobBool(context, label: 'Use initials', initialValue: true)
|
||||
? initials
|
||||
: null,
|
||||
radius: knobDouble(context, label: 'Radius', initialValue: 32, min: 12, max: 56),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
WidgetbookUseCase(
|
||||
name: 'Sizes',
|
||||
builder: (context) {
|
||||
return const IosPreview.centered(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
AppAvatar(initials: 'А', radius: 16),
|
||||
SizedBox(width: AppSpacing.s4),
|
||||
AppAvatar(initials: 'ВА', radius: 22),
|
||||
SizedBox(width: AppSpacing.s4),
|
||||
AppAvatar(radius: 32),
|
||||
SizedBox(width: AppSpacing.s4),
|
||||
AppAvatar(initials: 'ППМ', radius: 44),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
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 cardsComponent() {
|
||||
return WidgetbookComponent(
|
||||
name: 'AppCard',
|
||||
useCases: [
|
||||
WidgetbookUseCase(
|
||||
name: 'Playground',
|
||||
builder: (context) {
|
||||
final subtitle = knobText(context, label: 'Subtitle', initialValue: 'До 25 сентября');
|
||||
return IosPreview(
|
||||
stretch: true,
|
||||
child: AppCard(
|
||||
title: knobText(context, label: 'Title', initialValue: 'Бюджет'),
|
||||
subtitle: subtitle.isEmpty ? null : subtitle,
|
||||
onTap: knobBool(context, label: 'Tappable') ? () {} : null,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText.largeTitle(
|
||||
knobText(context, label: 'Amount', initialValue: '18 420 ₽'),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.s4),
|
||||
AppProgressBar(
|
||||
value: knobDouble(context, label: 'Progress', initialValue: 0.42),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
WidgetbookUseCase(
|
||||
name: 'Metrics row',
|
||||
builder: (context) {
|
||||
return const IosPreview(
|
||||
stretch: true,
|
||||
child: AppCard(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText.footnote('Доход'),
|
||||
AppText.title('64 000 ₽'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText.footnote('Расход'),
|
||||
AppText.title('45 580 ₽', color: AppColors.systemRed),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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 chipsComponent() {
|
||||
return WidgetbookComponent(
|
||||
name: 'AppChip',
|
||||
useCases: [
|
||||
WidgetbookUseCase(
|
||||
name: 'Playground',
|
||||
builder: (context) {
|
||||
return IosPreview.centered(
|
||||
child: AppChip(
|
||||
label: knobText(context, label: 'Label', initialValue: 'Еда'),
|
||||
selected: knobBool(context, label: 'Selected'),
|
||||
icon: knobBool(context, label: 'Icon') ? CupertinoIcons.tag_fill : null,
|
||||
onPressed: () {},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
WidgetbookUseCase(
|
||||
name: 'Filter row',
|
||||
builder: (context) {
|
||||
final selected = knobInt(context, label: 'Selected index', min: 0, max: 3);
|
||||
const labels = ['Все', 'Еда', 'Транспорт', 'Подписки'];
|
||||
return IosPreview.centered(
|
||||
child: Wrap(
|
||||
spacing: AppSpacing.s2,
|
||||
runSpacing: AppSpacing.s2,
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
for (final (index, label) in labels.indexed)
|
||||
AppChip(label: label, selected: index == selected, onPressed: () {}),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
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/knobs/state_knobs.dart';
|
||||
import 'package:please_pay_me_widgetbook/support/preview.dart';
|
||||
import 'package:widgetbook/widgetbook.dart';
|
||||
|
||||
WidgetbookComponent listTilesComponent() {
|
||||
return WidgetbookComponent(
|
||||
name: 'AppListTile',
|
||||
useCases: [
|
||||
WidgetbookUseCase(
|
||||
name: 'Playground',
|
||||
builder: (context) {
|
||||
final subtitle = knobText(context, label: 'Subtitle', initialValue: 'Супермаркет');
|
||||
final value = knobText(context, label: 'Value', initialValue: '−1 840 ₽');
|
||||
return IosPreview(
|
||||
stretch: true,
|
||||
child: AppListSection(
|
||||
separatorIndent: 60,
|
||||
children: [
|
||||
AppListTile(
|
||||
leading: knobBool(context, label: 'Leading badge', initialValue: true)
|
||||
? const AppIconBadge(icon: CupertinoIcons.cart_fill)
|
||||
: null,
|
||||
title: knobText(context, label: 'Title', initialValue: 'Продукты'),
|
||||
subtitle: subtitle.isEmpty ? null : subtitle,
|
||||
value: value.isEmpty ? null : value,
|
||||
destructive: knobBool(context, label: 'Destructive'),
|
||||
showChevron: knobBool(context, label: 'Chevron', initialValue: true),
|
||||
onTap: knobBool(context, label: 'Tappable', initialValue: true) ? () {} : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
WidgetbookUseCase(
|
||||
name: 'Grouped section',
|
||||
builder: (context) {
|
||||
final state = knobAsyncState(context);
|
||||
return IosPreview(
|
||||
stretch: true,
|
||||
child: AppListSection(
|
||||
header: 'Сегодня',
|
||||
footer: 'Свайп по строке открывает действия.',
|
||||
separatorIndent: 60,
|
||||
children: [
|
||||
wrapAsyncState(
|
||||
context: context,
|
||||
state: state,
|
||||
builder: () => const Column(
|
||||
children: [
|
||||
AppListTile(
|
||||
leading: AppIconBadge(icon: CupertinoIcons.cart_fill),
|
||||
title: 'Продукты',
|
||||
subtitle: 'Супермаркет',
|
||||
value: '−1 840 ₽',
|
||||
),
|
||||
AppListTile(
|
||||
leading: AppIconBadge(
|
||||
icon: CupertinoIcons.car_fill,
|
||||
color: AppColors.systemOrange,
|
||||
),
|
||||
title: 'Такси',
|
||||
subtitle: 'Транспорт',
|
||||
value: '−420 ₽',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
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: (_) {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user