-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Widget Catalog with widgetbook
- Loading branch information
Showing
48 changed files
with
2,565 additions
and
0 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 |
---|---|---|
|
@@ -41,6 +41,7 @@ unawaited | |
unfocus | ||
utsname | ||
vsync | ||
widgetbook | ||
wireframe | ||
xcarchive | ||
xcconfig | ||
|
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
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,55 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Editor User Setting Files | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
!.vscode/*.code-snippets | ||
*.code-workspace | ||
!default.code-workspace | ||
.classpath | ||
.project | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
flutter_*.png | ||
linked_*.ds | ||
unlinked.ds | ||
unlinked_spec.ds | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android Studio will place build artifacts here | ||
/android/app/debug | ||
/android/app/profile | ||
/android/app/release |
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,33 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: "5874a72aa4c779a02553007c47dacbefba2374dc" | ||
channel: "stable" | ||
|
||
project_type: app | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc | ||
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc | ||
- platform: macos | ||
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc | ||
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc | ||
- platform: web | ||
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc | ||
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc | ||
|
||
# User provided section | ||
|
||
# List of Local paths (relative to this file) that should be | ||
# ignored by the migrate tool. | ||
# | ||
# Files that are not part of the templates will be ignored by default. | ||
unmanaged_files: | ||
- 'lib/main.dart' | ||
- 'ios/Runner.xcodeproj/project.pbxproj' |
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,3 @@ | ||
# Widget Catalog | ||
|
||
Widget Catalog with flutter_app_template. |
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,8 @@ | ||
include: package:altive_lints/altive_lints.yaml | ||
analyzer: | ||
plugins: | ||
- custom_lint | ||
linter: | ||
rules: | ||
# Because WidgetCatalog often does not use the public methods you define from other places. | ||
- public_member_api_docs: false |
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,8 @@ | ||
targets: | ||
$default: | ||
builders: | ||
widgetbook_generator:use_case_builder: | ||
generate_for: | ||
- lib/widgets/** | ||
widgetbook_generator:telemetry: | ||
enabled: false |
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,64 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:themes/themes.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart'; | ||
|
||
import 'main.directories.g.dart'; | ||
|
||
void main() { | ||
runApp(const MainApp()); | ||
} | ||
|
||
/// Widget Catalog app. | ||
@App() | ||
class MainApp extends StatelessWidget { | ||
/// Creates a new instance of [MainApp]. | ||
const MainApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Widgetbook.material( | ||
directories: directories, | ||
lightTheme: lightThemeData, | ||
darkTheme: darkThemeData, | ||
addons: [ | ||
MaterialThemeAddon( | ||
themes: [ | ||
WidgetbookTheme(name: 'Light', data: lightThemeData), | ||
WidgetbookTheme(name: 'Dark', data: darkThemeData), | ||
], | ||
), | ||
TextScaleAddon( | ||
scales: [1.0, 2.0], | ||
), | ||
LocalizationAddon( | ||
locales: [ | ||
const Locale('en', 'US'), | ||
const Locale('ja', 'JP'), | ||
], | ||
localizationsDelegates: [ | ||
DefaultWidgetsLocalizations.delegate, | ||
DefaultMaterialLocalizations.delegate, | ||
DefaultCupertinoLocalizations.delegate, | ||
], | ||
), | ||
InspectorAddon(enabled: true), | ||
DeviceFrameAddon( | ||
initialDevice: Devices.ios.iPhoneSE, | ||
devices: [ | ||
Devices.ios.iPhoneSE, | ||
Devices.ios.iPhone13ProMax, | ||
], | ||
), | ||
GridAddon(44), | ||
AlignmentAddon(), | ||
], | ||
appBuilder: (context, child) { | ||
return Scaffold( | ||
body: child, | ||
); | ||
}, | ||
); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
packages/widget_catalog/lib/widgets/apple_auth_button.dart
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,20 @@ | ||
import 'package:convenient_widgets/convenient_widgets.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart'; | ||
|
||
@UseCase( | ||
name: 'Default', | ||
type: AppleAuthButton, | ||
path: '[Interactions]/buttons', | ||
) | ||
Widget appleAuthButton(BuildContext context) { | ||
return AppleAuthButton( | ||
onPressed: () {}, | ||
labelText: context.knobs.string( | ||
label: 'Button label', | ||
description: 'The text displayed on the button', | ||
initialValue: 'Sign in with Apple', | ||
), | ||
); | ||
} |
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,27 @@ | ||
import 'package:convenient_widgets/convenient_widgets.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart'; | ||
|
||
@UseCase(name: 'Left', type: ShapeDecoration) | ||
Widget leftBubbleBorder(BuildContext context) { | ||
return Container( | ||
width: 100, | ||
height: 100, | ||
decoration: ShapeDecoration( | ||
shape: const BubbleBorder(), | ||
color: Theme.of(context).colorScheme.surface, | ||
), | ||
); | ||
} | ||
|
||
@UseCase(name: 'Right', type: ShapeDecoration) | ||
Widget rightBubbleBorder(BuildContext context) { | ||
return Container( | ||
width: 100, | ||
height: 100, | ||
decoration: ShapeDecoration( | ||
shape: const BubbleBorder(destination: Destination.right), | ||
color: Theme.of(context).colorScheme.surface, | ||
), | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/widget_catalog/lib/widgets/google_auth_button.dart
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,20 @@ | ||
import 'package:convenient_widgets/convenient_widgets.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart'; | ||
|
||
@UseCase( | ||
name: 'Default', | ||
type: GoogleAuthButton, | ||
path: '[Interactions]/buttons', | ||
) | ||
Widget googleAuthButton(BuildContext context) { | ||
return GoogleAuthButton( | ||
onPressed: () {}, | ||
labelText: context.knobs.string( | ||
label: 'Button label', | ||
description: 'The text displayed on the button', | ||
initialValue: 'Sign in with Google', | ||
), | ||
); | ||
} |
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,7 @@ | ||
# Flutter-related | ||
**/Flutter/ephemeral/ | ||
**/Pods/ | ||
|
||
# Xcode-related | ||
**/dgph | ||
**/xcuserdata/ |
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 @@ | ||
#include "ephemeral/Flutter-Generated.xcconfig" |
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 @@ | ||
#include "ephemeral/Flutter-Generated.xcconfig" |
Oops, something went wrong.