-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding widgetbook use cases for texts
- Loading branch information
1 parent
2558fb6
commit 2fd056f
Showing
2 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:nes_ui/nes_ui.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
|
||
Widget build({ | ||
required List<TextStyle?> textStyles, | ||
required List<String> texts, | ||
}) => | ||
Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
for (var i = 0; i < textStyles.length; i++) | ||
Padding( | ||
padding: const EdgeInsets.all(8), | ||
child: Text( | ||
texts[i], | ||
style: textStyles[i], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'body', | ||
type: Text, | ||
) | ||
Widget body(BuildContext context) => build( | ||
textStyles: [ | ||
Theme.of(context).textTheme.bodySmall, | ||
Theme.of(context).textTheme.bodyMedium, | ||
Theme.of(context).textTheme.bodyLarge, | ||
], | ||
texts: [ | ||
'Body Small', | ||
'Body Medium', | ||
'Body Large', | ||
], | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'display', | ||
type: Text, | ||
) | ||
Widget display(BuildContext context) => build( | ||
textStyles: [ | ||
Theme.of(context).textTheme.displaySmall, | ||
Theme.of(context).textTheme.displayMedium, | ||
Theme.of(context).textTheme.displayLarge, | ||
], | ||
texts: [ | ||
'Display Small', | ||
'Display Medium', | ||
'Display Large', | ||
], | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'headline', | ||
type: Text, | ||
) | ||
Widget headline(BuildContext context) => build( | ||
textStyles: [ | ||
Theme.of(context).textTheme.headlineSmall, | ||
Theme.of(context).textTheme.headlineMedium, | ||
Theme.of(context).textTheme.headlineLarge, | ||
], | ||
texts: [ | ||
'Headline Small', | ||
'Headline Medium', | ||
'Headline Large', | ||
], | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'title', | ||
type: Text, | ||
) | ||
Widget title(BuildContext context) => build( | ||
textStyles: [ | ||
Theme.of(context).textTheme.titleSmall, | ||
Theme.of(context).textTheme.titleMedium, | ||
Theme.of(context).textTheme.titleLarge, | ||
], | ||
texts: [ | ||
'Title Small', | ||
'Title Medium', | ||
'Title Large', | ||
], | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'label', | ||
type: Text, | ||
) | ||
Widget label(BuildContext context) => build( | ||
textStyles: [ | ||
Theme.of(context).textTheme.labelSmall, | ||
Theme.of(context).textTheme.labelMedium, | ||
Theme.of(context).textTheme.labelLarge, | ||
], | ||
texts: [ | ||
'Label Small', | ||
'Label Medium', | ||
'Label Large', | ||
], | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters