forked from mirrors/material_3_expressive
Add Widgetbook setup with theme configuration, analysis options, and initial component use cases
This commit is contained in:
parent
d3ad4b9c9d
commit
80ca8f665a
46 changed files with 6031 additions and 2 deletions
40
widgetbook/lib/main.dart
Normal file
40
widgetbook/lib/main.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:m3e_design/m3e_design.dart';
|
||||
import 'package:widgetbook/widgetbook.dart';
|
||||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
|
||||
|
||||
// Generated by widgetbook_generator
|
||||
import 'main.directories.g.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const WidgetbookApp());
|
||||
}
|
||||
|
||||
@widgetbook.App()
|
||||
class WidgetbookApp extends StatelessWidget {
|
||||
const WidgetbookApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeLight =
|
||||
ColorScheme.fromSeed(seedColor: Colors.purple).toM3EThemeData();
|
||||
final themeDark = ColorScheme.fromSeed(
|
||||
seedColor: Colors.purple, brightness: Brightness.dark)
|
||||
.toM3EThemeData();
|
||||
|
||||
return Widgetbook.material(
|
||||
directories: directories,
|
||||
lightTheme: themeLight,
|
||||
darkTheme: themeDark,
|
||||
addons: [
|
||||
MaterialThemeAddon(
|
||||
themes: [
|
||||
WidgetbookTheme(name: 'Light', data: themeLight),
|
||||
WidgetbookTheme(name: 'Dark', data: themeDark),
|
||||
],
|
||||
),
|
||||
TextScaleAddon(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue