-
-
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 * moving widgetbook to be a standalone app * fix workflow * format * fixing tests
- Loading branch information
1 parent
a207567
commit 9324d9a
Showing
21 changed files
with
459 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: widgetbook | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
paths: | ||
- "widgetbook/**" | ||
- ".github/workflows/widgetbook.yaml" | ||
|
||
pull_request: | ||
paths: | ||
- "widgetbook/**" | ||
- ".github/workflows/widgetbook.yaml" | ||
|
||
jobs: | ||
build: | ||
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/[email protected] | ||
with: | ||
min_coverage: 0 | ||
working_directory: widgetbook |
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,43 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# 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,30 @@ | ||
# 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: "b0366e0a3f089e15fd89c97604ab402fe26b724c" | ||
channel: "stable" | ||
|
||
project_type: app | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: web | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
|
||
# 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 @@ | ||
# widgetbook | ||
|
||
Widgetbook for NES UI |
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: package:very_good_analysis/analysis_options.5.1.0.yaml |
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,6 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook_app/widgetbook/widgetbook.dart'; | ||
|
||
void main() { | ||
runApp(const WidgetbookApp()); | ||
} |
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,62 @@ | ||
// 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 NesButtonType type, | ||
required String text, | ||
}) => | ||
Center( | ||
child: NesButton( | ||
onPressed: () {}, | ||
type: type, | ||
child: Text(text), | ||
), | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'normal', | ||
type: NesButton, | ||
) | ||
Widget normal(BuildContext context) => build( | ||
type: NesButtonType.normal, | ||
text: 'Normal', | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'primary', | ||
type: NesButton, | ||
) | ||
Widget primary(BuildContext context) => build( | ||
type: NesButtonType.primary, | ||
text: 'Primary', | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'success', | ||
type: NesButton, | ||
) | ||
Widget success(BuildContext context) => build( | ||
type: NesButtonType.success, | ||
text: 'Success', | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'warning', | ||
type: NesButton, | ||
) | ||
Widget warning(BuildContext context) => build( | ||
type: NesButtonType.warning, | ||
text: 'Warning', | ||
); | ||
|
||
@widgetbook.UseCase( | ||
name: 'error', | ||
type: NesButton, | ||
) | ||
Widget error(BuildContext context) => build( | ||
type: NesButtonType.error, | ||
text: 'Error', | ||
); |
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,29 @@ | ||
// 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() { | ||
var selected = false; | ||
return Center( | ||
child: StatefulBuilder( | ||
builder: (context, setState) { | ||
return NesCheckBox( | ||
onChange: (value) { | ||
setState(() { | ||
selected = value; | ||
}); | ||
}, | ||
value: selected, | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
|
||
@widgetbook.UseCase( | ||
name: 'default', | ||
type: NesCheckBox, | ||
) | ||
Widget checkbox(BuildContext context) => build(); |
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,49 @@ | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:nes_ui/nes_ui.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
import 'package:widgetbook_app/widgetbook/widgetbook.directories.g.dart'; | ||
import 'package:widgetbook_app/widgetbook/widgets/widgets.dart'; | ||
|
||
@widgetbook.App() | ||
class WidgetbookApp extends StatelessWidget { | ||
const WidgetbookApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Widgetbook.material( | ||
directories: directories, | ||
integrations: [ | ||
WidgetbookCloudIntegration(), | ||
], | ||
addons: [ | ||
BuilderAddon( | ||
name: 'Decorator', | ||
builder: (context, child) { | ||
return UseCaseDecorator(child: child); | ||
}, | ||
), | ||
ThemeAddon( | ||
themes: [ | ||
WidgetbookTheme( | ||
name: 'Light', | ||
data: flutterNesTheme(), | ||
), | ||
WidgetbookTheme( | ||
name: 'Dark', | ||
data: flutterNesTheme(brightness: Brightness.dark), | ||
), | ||
], | ||
themeBuilder: (context, theme, child) { | ||
return Theme( | ||
data: theme, | ||
child: child, | ||
); | ||
}, | ||
), | ||
], | ||
); | ||
} | ||
} |
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,54 @@ | ||
// coverage:ignore-file | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: unused_import, prefer_relative_imports, directives_ordering | ||
|
||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
|
||
// ************************************************************************** | ||
// AppGenerator | ||
// ************************************************************************** | ||
|
||
// ignore_for_file: no_leading_underscores_for_library_prefixes | ||
import 'package:widgetbook/widgetbook.dart' as _i1; | ||
import 'package:widgetbook_app/widgetbook/use_cases/buttons.dart' as _i2; | ||
import 'package:widgetbook_app/widgetbook/use_cases/checkboxes.dart' as _i3; | ||
|
||
final directories = <_i1.WidgetbookNode>[ | ||
_i1.WidgetbookFolder( | ||
name: 'widgets', | ||
children: [ | ||
_i1.WidgetbookComponent( | ||
name: 'NesButton', | ||
useCases: [ | ||
_i1.WidgetbookUseCase( | ||
name: 'error', | ||
builder: _i2.error, | ||
), | ||
_i1.WidgetbookUseCase( | ||
name: 'normal', | ||
builder: _i2.normal, | ||
), | ||
_i1.WidgetbookUseCase( | ||
name: 'primary', | ||
builder: _i2.primary, | ||
), | ||
_i1.WidgetbookUseCase( | ||
name: 'success', | ||
builder: _i2.success, | ||
), | ||
_i1.WidgetbookUseCase( | ||
name: 'warning', | ||
builder: _i2.warning, | ||
), | ||
], | ||
), | ||
_i1.WidgetbookLeafComponent( | ||
name: 'NesCheckBox', | ||
useCase: _i1.WidgetbookUseCase( | ||
name: 'default', | ||
builder: _i3.checkbox, | ||
), | ||
), | ||
], | ||
) | ||
]; |
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,24 @@ | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
class UseCaseDecorator extends StatelessWidget { | ||
const UseCaseDecorator({ | ||
required this.child, | ||
super.key, | ||
}); | ||
|
||
final Widget child; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return DecoratedBox( | ||
decoration: BoxDecoration( | ||
color: Colors.grey[600], | ||
), | ||
child: SizedBox.expand( | ||
child: child, | ||
), | ||
); | ||
} | ||
} |
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 @@ | ||
export 'use_case_decorator.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,28 @@ | ||
name: widgetbook_app | ||
description: "Widgetbook for NES UI" | ||
|
||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||
|
||
version: 1.0.0+1 | ||
|
||
environment: | ||
sdk: '>=3.2.3 <4.0.0' | ||
|
||
dependencies: | ||
cupertino_icons: ^1.0.2 | ||
flutter: | ||
sdk: flutter | ||
nes_ui: | ||
path: .. | ||
widgetbook: ^3.7.0 | ||
widgetbook_annotation: ^3.1.0 | ||
|
||
dev_dependencies: | ||
build_runner: ^2.4.7 | ||
flutter_test: | ||
sdk: flutter | ||
very_good_analysis: ">=3.1.0 <6.0.0" | ||
widgetbook_generator: ^3.7.0 | ||
|
||
flutter: | ||
uses-material-design: true |
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,12 @@ | ||
// ignore_for_file: prefer_const_constructors | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:widgetbook_app/widgetbook/widgetbook.dart'; | ||
|
||
void main() { | ||
testWidgets('renders', (WidgetTester tester) async { | ||
await tester.pumpWidget(WidgetbookApp()); | ||
|
||
expect(find.byType(WidgetbookApp), findsOneWidget); | ||
}); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.