From a07be0336b4db6f43cc7856880703800f391218a Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 21 May 2024 17:43:59 +0100 Subject: [PATCH 1/6] chore: add version to example app --- example/lib/home.dart | 4 ++- release-please-config.json | 60 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/example/lib/home.dart b/example/lib/home.dart index 492c343b..d82ad9e4 100644 --- a/example/lib/home.dart +++ b/example/lib/home.dart @@ -148,7 +148,9 @@ class _HomeState extends State { final _assets = assets..sort((a, b) => a.name.compareTo(b.name)); final _theme = theme..sort((a, b) => a.name.compareTo(b.name)); return ExampleScaffold( - name: 'Zeta', + // x-release-please-start-version + name: 'zeta_flutter v1.2.4', + // x-release-please-end child: SingleChildScrollView( child: Column( children: [ diff --git a/release-please-config.json b/release-please-config.json index 66d1ec8a..8a766b83 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -4,5 +4,63 @@ "release-type": "dart" } }, - "include-component-in-tag": false + "include-component-in-tag": false, + "extra-files": [ + "example/lib/home.dart" + ], + "changelog-sections": [ + { + "type": "feat", + "section": "โœจ New Features" + }, + { + "type": "fix", + "section": "๐Ÿชฒ Bug Fixes" + }, + { + "type": "revert", + "section": "๐Ÿ‘€ Reverts" + }, + { + "type": "docs", + "section": "๐Ÿ“ˆ Documentation" + }, + { + "type": "deps", + "section": "โ›“๏ธ Dependencies" + }, + { + "type": "test", + "section": "๐Ÿงช Tests" + }, + { + "type": "chore", + "section": "๐Ÿงน Miscellaneous Chores" + }, + { + "type": "perf", + "section": "Performance Improvements", + "hidden": true + }, + { + "type": "refactor", + "section": "Code Refactoring", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "build", + "section": "Build System", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ] } \ No newline at end of file From 72fe1059bd1670325f8e05f6a92774a60a2b38b3 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 22 May 2024 16:10:56 +0100 Subject: [PATCH 2/6] deps: Update example app / widgetbook deps --- example/linux/flutter/generated_plugin_registrant.cc | 4 ++++ example/linux/flutter/generated_plugins.cmake | 1 + example/macos/Flutter/GeneratedPluginRegistrant.swift | 2 ++ example/macos/Podfile.lock | 6 ++++++ example/windows/flutter/generated_plugin_registrant.cc | 3 +++ example/windows/flutter/generated_plugins.cmake | 1 + 6 files changed, 17 insertions(+) diff --git a/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc index e71a16d2..f6f23bfe 100644 --- a/example/linux/flutter/generated_plugin_registrant.cc +++ b/example/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake index 2e1de87a..f16b4c34 100644 --- a/example/linux/flutter/generated_plugins.cmake +++ b/example/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index eefcc6d7..63ad0d13 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,9 +8,11 @@ import Foundation import path_provider_foundation import shared_preferences_foundation import sqflite +import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 8ed0a812..66e9c6e8 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -9,12 +9,15 @@ PODS: - sqflite (0.0.3): - Flutter - FlutterMacOS + - url_launcher_macos (0.0.1): + - FlutterMacOS DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`) + - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) EXTERNAL SOURCES: FlutterMacOS: @@ -25,12 +28,15 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin sqflite: :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin + url_launcher_macos: + :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc index 8b6d4680..4f788487 100644 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ b/example/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index b93c4c30..88b22e5c 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From 455d450d0161ec7dbeeaf215811e14d2161782ee Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 22 May 2024 16:12:41 +0100 Subject: [PATCH 3/6] chore: update example app web implementation --- example/web/index.html | 27 +++------------------------ example/web/manifest.json | 8 ++++---- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/example/web/index.html b/example/web/index.html index f9b1d73c..e1deead4 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -24,39 +24,18 @@ - + - zeta_flutter_example + zeta_flutter example - - - - - + \ No newline at end of file diff --git a/example/web/manifest.json b/example/web/manifest.json index 6a2b8dc5..9f3c9b11 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -1,11 +1,11 @@ { - "name": "zeta_flutter_example", - "short_name": "zeta_flutter_example", + "name": "zeta_flutter example", + "short_name": "zeta_flutter example", "start_url": ".", "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "Demonstrates how to use the zeta_flutter plugin.", + "description": "Demonstrates how to use the zeta_flutter library", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ @@ -32,4 +32,4 @@ "purpose": "maskable" } ] -} +} \ No newline at end of file From 17e923c4c351249e2709c924273070ee1d869d0d Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 22 May 2024 17:20:11 +0100 Subject: [PATCH 4/6] docs: Add introduction page to widgetbook --- README.md | 4 +- example/assets/zebra-logo-head.svg | 6 + example/lib/home.dart | 2 +- example/pubspec.yaml | 5 + example/widgetbook/main.dart | 22 ++- example/widgetbook/pages/introduction.dart | 171 +++++++++++++++++++++ 6 files changed, 204 insertions(+), 6 deletions(-) create mode 100644 example/assets/zebra-logo-head.svg create mode 100644 example/widgetbook/pages/introduction.dart diff --git a/README.md b/README.md index 8fd99562..44f66d3a 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Zeta is the new, formal, standardized Zebra Design System based off the successe ### Prerequisites ``` - dart sdk: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" +dart sdk: ">=3.2.0 <4.0.0" +flutter: ">=3.16.0" ``` ## Installation diff --git a/example/assets/zebra-logo-head.svg b/example/assets/zebra-logo-head.svg new file mode 100644 index 00000000..5b7ff704 --- /dev/null +++ b/example/assets/zebra-logo-head.svg @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/example/lib/home.dart b/example/lib/home.dart index d82ad9e4..7201d7c5 100644 --- a/example/lib/home.dart +++ b/example/lib/home.dart @@ -149,7 +149,7 @@ class _HomeState extends State { final _theme = theme..sort((a, b) => a.name.compareTo(b.name)); return ExampleScaffold( // x-release-please-start-version - name: 'zeta_flutter v1.2.4', + name: 'zeta_flutter v0.9.1', // x-release-please-end child: SingleChildScrollView( child: Column( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index be247afe..3e3314fb 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -11,9 +11,13 @@ dependencies: cached_network_image: ^3.3.1 flutter: sdk: flutter + flutter_svg: ^2.0.10+1 go_router: ^14.1.2 + google_fonts: ^6.2.1 + markdown_widget: ^2.3.2+6 path_drawing: ^1.0.1 shared_preferences: ^2.2.2 + url_launcher: ^6.2.6 zeta_flutter: path: ../ @@ -26,3 +30,4 @@ flutter: uses-material-design: true assets: - assets/ + - ../README.md diff --git a/example/widgetbook/main.dart b/example/widgetbook/main.dart index 5083dfe9..78292528 100644 --- a/example/widgetbook/main.dart +++ b/example/widgetbook/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -42,22 +43,37 @@ import 'pages/components/snack_bar_widgetbook.dart'; import 'pages/components/tabs_widgetbook.dart'; import 'pages/components/time_input_widgetbook.dart'; import 'pages/components/tooltip_widgetbook.dart'; +import 'pages/introduction.dart'; import 'pages/theme/color_widgetbook.dart'; import 'pages/theme/radius_widgetbook.dart'; import 'pages/theme/spacing_widgetbook.dart'; import 'pages/theme/typography_widgetbook.dart'; import 'utils/zebra.dart'; -void main() => runApp(const HotReload()); +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + String readme = await rootBundle.loadString('../README.md'); -class HotReload extends StatelessWidget { - const HotReload({super.key}); + runApp(HotReload(readme: readme)); +} + +class HotReload extends StatefulWidget { + final String readme; + const HotReload({super.key, required this.readme}); + + @override + State createState() => _HotReloadState(); +} +class _HotReloadState extends State { @override Widget build(BuildContext context) { return Widgetbook( appBuilder: (context, child) => child, + initialRoute: '?path=introduction', directories: [ + WidgetbookUseCase( + name: 'Introduction', builder: (BuildContext context) => IntroductionWidgetbook(readme: widget.readme)), WidgetbookCategory( name: 'Components', isInitiallyExpanded: false, diff --git a/example/widgetbook/pages/introduction.dart b/example/widgetbook/pages/introduction.dart new file mode 100644 index 00000000..e28c1c5d --- /dev/null +++ b/example/widgetbook/pages/introduction.dart @@ -0,0 +1,171 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:markdown_widget/config/configs.dart'; +import 'package:markdown_widget/widget/all.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:zeta_flutter/zeta_flutter.dart'; + +class IntroductionWidgetbook extends StatefulWidget { + final String readme; + const IntroductionWidgetbook({super.key, required this.readme}); + + @override + State createState() => _IntroductionWidgetbookState(); +} + +class _IntroductionWidgetbookState extends State { + late String readme; + @override + void initState() { + super.initState(); + readme = widget.readme.replaceAll('# Zeta Flutter', '').trim(); + } + + @override + Widget build(BuildContext context) { + final colors = Zeta.of(context).colors; + final radius = Radius.circular(ZetaSpacing.x5); + final isDark = Zeta.of(context).brightness == Brightness.dark; + final config = isDark ? MarkdownConfig.darkConfig : MarkdownConfig.defaultConfig; + + return LayoutBuilder(builder: (context, constraints) { + final bool largeScreen = constraints.maxWidth > 480; + return Scaffold( + backgroundColor: colors.black, + body: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.symmetric(vertical: ZetaSpacing.xxl, horizontal: ZetaSpacing.s), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + decoration: BoxDecoration( + color: colors.cool.shade20, + borderRadius: BorderRadius.only(topLeft: radius, topRight: radius), + ), + child: Padding( + padding: EdgeInsets.fromLTRB( + ZetaSpacing.x10, + ZetaSpacing.x1 * 15, + ZetaSpacing.x12, + ZetaSpacing.x10, + ), + child: Row( + children: [ + SvgPicture.asset( + './assets/zebra-logo-head.svg', + height: largeScreen ? 80 : 40, + width: largeScreen ? 80 : 40, + colorFilter: isDark + ? const ColorFilter.matrix([ + -1.0, 0.0, 0.0, 0.0, 255.0, // + 0.0, -1.0, 0.0, 0.0, 255.0, // + 0.0, 0.0, -1.0, 0.0, 255.0, // + 0.0, 0.0, 0.0, 1.0, 0.0, // + ]) + : null, + ), + SizedBox(width: largeScreen ? ZetaSpacing.x10 : ZetaSpacing.x5), + Expanded( + child: Text( + // x-release-please-start-version + 'zeta_flutter v0.9.1', + // x-release-please-end + style: ZetaTextStyles.displayLarge.copyWith(fontSize: largeScreen ? null : 24), + ), + ), + ], + ), + ), + ), + Container( + decoration: BoxDecoration( + color: isDark ? colors.warm.shade10 : colors.surfacePrimary, + borderRadius: BorderRadius.only(bottomLeft: radius, bottomRight: radius), + ), + width: double.infinity, + padding: EdgeInsets.all(ZetaSpacing.x8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + MarkdownWidget( + data: readme, + shrinkWrap: true, + config: config.copy( + configs: [ + LinkConfig( + style: TextStyle( + color: colors.blue.shade50, + decoration: TextDecoration.underline, + ), + onTap: (url) { + final Uri? uri = Uri.tryParse(url); + if (uri != null && uri.isAbsolute) { + launchUrl(uri); + } else { + final Uri? uri2 = + Uri.tryParse('https://github.com/ZebraDevs/zeta_flutter/blob/main/' + url); + if (uri2 != null && uri2.isAbsolute) { + launchUrl(uri2); + } + } + }, + ), + CodeConfig(style: GoogleFonts.ibmPlexMono()), + isDark + ? PreConfig.darkConfig.copy( + textStyle: GoogleFonts.ibmPlexMono(), + wrapper: (child, _, language) => _CodeWrapperWidget(child, language), + ) + : PreConfig( + textStyle: GoogleFonts.ibmPlexMono(), + wrapper: (child, _, language) => _CodeWrapperWidget(child, language), + ) + ], + ), + ) + ], + ), + ), + ], + ), + ), + ), + ); + }); + } +} + +class _CodeWrapperWidget extends StatelessWidget { + final Widget child; + final String language; + + const _CodeWrapperWidget(this.child, this.language, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final colors = Zeta.of(context).colors; + + return Stack( + children: [ + DefaultTextStyle( + style: GoogleFonts.ibmPlexMono(color: Zeta.of(context).colors.textDefault), + child: child, + ), + if (language.isNotEmpty) + Positioned( + top: ZetaSpacing.x2, + right: 0, + child: SelectionContainer.disabled( + child: Container( + child: Text(language), + padding: EdgeInsets.symmetric(vertical: ZetaSpacing.x1, horizontal: ZetaSpacing.x3), + decoration: BoxDecoration(color: colors.cool.shade40, borderRadius: ZetaRadius.rounded), + ), + ), + ), + ], + ); + } +} From 230ca383b8576e77a2cb8669d92a30822b0987b5 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 22 May 2024 18:00:35 +0100 Subject: [PATCH 5/6] docs: Add new addons to widgetbook --- example/widgetbook/main.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/example/widgetbook/main.dart b/example/widgetbook/main.dart index 78292528..16547e33 100644 --- a/example/widgetbook/main.dart +++ b/example/widgetbook/main.dart @@ -73,7 +73,9 @@ class _HotReloadState extends State { initialRoute: '?path=introduction', directories: [ WidgetbookUseCase( - name: 'Introduction', builder: (BuildContext context) => IntroductionWidgetbook(readme: widget.readme)), + name: 'Introduction', + builder: (BuildContext context) => IntroductionWidgetbook(readme: widget.readme), + ), WidgetbookCategory( name: 'Components', isInitiallyExpanded: false, @@ -237,6 +239,10 @@ class _HotReloadState extends State { ); }, ), + AccessibilityAddon(), + InspectorAddon(enabled: false), + ZoomAddon(initialZoom: 1.0), + TextScaleAddon(scales: [1.0, 1.2, 1.4, 1.6, 1.8, 2.0], initialScale: 1), ], ); } From 0e1a3bde834ed56db30b1107862ffa6bc77090af Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 23 May 2024 16:55:32 +0100 Subject: [PATCH 6/6] docs: fix thememode mismatch in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 44f66d3a..d8f0c390 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Zeta allows you to specify an initial theme mode for your app, which can be one By default, the theme mode is set to `ThemeMode.system`. ```dart -initialThemeMode: ThemeMode.light +initialThemeMode: ThemeMode.system ``` ### Providing Initial Theme Data