From 7f28a18b573a224ffa006c945703fafd5bde6e9f Mon Sep 17 00:00:00 2001 From: Roscoe Rubin-Rottenberg Date: Mon, 15 Dec 2025 18:05:54 -0500 Subject: [PATCH] chore: format --- .../atoms/buttons/tappable_text.dart | 9 +- .../components/atoms/tags/tag.dart | 1 - .../templates/image_review_page_template.dart | 1 - lib/src/core/ui/widgets/image_content.dart | 11 ++- .../features/messages/ui/pages/chat_page.dart | 1 - .../providers/suggested_feeds_provider.dart | 2 +- widgetbook/lib/atoms/icons_showcase.dart | 8 +- widgetbook/lib/atoms/long_button.dart | 18 +--- widgetbook/lib/atoms/profile_tab_item.dart | 23 +++-- widgetbook/lib/main.dart | 2 +- widgetbook/lib/molecules/glass_input.dart | 85 +++++++++++++++---- widgetbook/lib/molecules/post_tile.dart | 33 +++++-- widgetbook/lib/tokens/colors.dart | 17 ++-- widgetbook/lib/tokens/typography_preview.dart | 13 +-- .../lib/widgetbook_usecases_templates.dart | 15 +++- 15 files changed, 164 insertions(+), 75 deletions(-) diff --git a/lib/src/core/design_system/components/atoms/buttons/tappable_text.dart b/lib/src/core/design_system/components/atoms/buttons/tappable_text.dart index a185c52e..9f05c693 100644 --- a/lib/src/core/design_system/components/atoms/buttons/tappable_text.dart +++ b/lib/src/core/design_system/components/atoms/buttons/tappable_text.dart @@ -7,7 +7,9 @@ class TappableText extends StatelessWidget { final VoidCallback onTap; const TappableText({ - required this.text, required this.onTap, super.key, + required this.text, + required this.onTap, + super.key, }); @override @@ -18,10 +20,7 @@ class TappableText extends StatelessWidget { width: 41, height: 14, child: Center( - child: Text( - text, - style: AppTypography.textExtraSmallThin - ), + child: Text(text, style: AppTypography.textExtraSmallThin), ), ), ); diff --git a/lib/src/core/design_system/components/atoms/tags/tag.dart b/lib/src/core/design_system/components/atoms/tags/tag.dart index 253ae790..9d43fd29 100644 --- a/lib/src/core/design_system/components/atoms/tags/tag.dart +++ b/lib/src/core/design_system/components/atoms/tags/tag.dart @@ -22,7 +22,6 @@ class Tag extends StatelessWidget { onTap: onTap, borderRadius: BorderRadius.circular(13), child: Container( - // width: 107, // height: 35, padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8), diff --git a/lib/src/core/design_system/templates/image_review_page_template.dart b/lib/src/core/design_system/templates/image_review_page_template.dart index be256cff..87950198 100644 --- a/lib/src/core/design_system/templates/image_review_page_template.dart +++ b/lib/src/core/design_system/templates/image_review_page_template.dart @@ -77,7 +77,6 @@ class ImageReviewPageTemplate extends StatelessWidget { leading: AppLeadingButton(color: theme.textTheme.titleLarge?.color, tooltip: 'Back'), title: Text( title, - ), centerTitle: false, ), diff --git a/lib/src/core/ui/widgets/image_content.dart b/lib/src/core/ui/widgets/image_content.dart index e9bbba21..7d75458c 100644 --- a/lib/src/core/ui/widgets/image_content.dart +++ b/lib/src/core/ui/widgets/image_content.dart @@ -57,7 +57,11 @@ class ImageContent extends StatelessWidget { placeholder: (context, url) => Container( color: Colors.grey[850]?.withValues(alpha: 128), child: const Center( - child: SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white54)), + child: SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white54), + ), ), ), errorWidget: (context, url, error) => ColoredBox( @@ -72,7 +76,10 @@ class ImageContent extends StatelessWidget { right: 4, child: Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), - decoration: BoxDecoration(color: Colors.black.withValues(alpha: 179), borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 179), + borderRadius: BorderRadius.circular(10), + ), child: Text( '+${imageUrls.length - 1}', style: const TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.bold), diff --git a/lib/src/features/messages/ui/pages/chat_page.dart b/lib/src/features/messages/ui/pages/chat_page.dart index 1e0e34d4..97e07df7 100644 --- a/lib/src/features/messages/ui/pages/chat_page.dart +++ b/lib/src/features/messages/ui/pages/chat_page.dart @@ -67,7 +67,6 @@ class _ChatPageState extends ConsumerState { } } - @override Widget build(BuildContext context) { final state = ref.watch(conversationProvider(widget.conversationId)); diff --git a/lib/src/features/search/providers/suggested_feeds_provider.dart b/lib/src/features/search/providers/suggested_feeds_provider.dart index 00b16d54..1d9d186e 100644 --- a/lib/src/features/search/providers/suggested_feeds_provider.dart +++ b/lib/src/features/search/providers/suggested_feeds_provider.dart @@ -31,7 +31,7 @@ class SuggestedFeeds extends _$SuggestedFeeds { /// Refresh the suggested feeds Future refresh() async { state = const AsyncValue.loading(); - + try { _logger.d('Refreshing suggested Spark feeds...'); // Only fetch Spark feeds diff --git a/widgetbook/lib/atoms/icons_showcase.dart b/widgetbook/lib/atoms/icons_showcase.dart index 542dbf13..5893b3b2 100644 --- a/widgetbook/lib/atoms/icons_showcase.dart +++ b/widgetbook/lib/atoms/icons_showcase.dart @@ -5,7 +5,13 @@ import 'package:widgetbook_annotation/widgetbook_annotation.dart'; @UseCase(name: 'grid', type: AppIcons) Widget buildAppIconsGridUseCase(BuildContext context) { - final size = context.knobs.double.slider(label: 'icon_size', initialValue: 28, min: 12, max: 64, divisions: 52); + final size = context.knobs.double.slider( + label: 'icon_size', + initialValue: 28, + min: 12, + max: 64, + divisions: 52, + ); final color = context.knobs.colorOrNull(label: 'tint_color'); final icons = [ AppIcons.add(size: size, color: color), diff --git a/widgetbook/lib/atoms/long_button.dart b/widgetbook/lib/atoms/long_button.dart index 7cca3a15..03a2a2f2 100644 --- a/widgetbook/lib/atoms/long_button.dart +++ b/widgetbook/lib/atoms/long_button.dart @@ -5,25 +5,15 @@ import 'package:widgetbook_annotation/widgetbook_annotation.dart'; // Assuming the LongButton component is located at this path import 'package:sparksocial/src/core/design_system/components/atoms/buttons/long_button.dart'; -@UseCase( - name: 'no_ui', - type: LongButton, -) +@UseCase(name: 'no_ui', type: LongButton) Widget buildLongButtonNoUIUseCase(BuildContext context) { return LongButton( - label: context.knobs.string( - label: 'Label', - initialValue: 'Continue', - ), + label: context.knobs.string(label: 'Label', initialValue: 'Continue'), onPressed: () => print('LongButton was pressed.'), ); } - -@UseCase( - name: 'resizable_parent', - type: LongButton, -) +@UseCase(name: 'resizable_parent', type: LongButton) Widget buildLongButtonInAResizableContainerUseCase(BuildContext context) { return Center( child: Container( @@ -56,4 +46,4 @@ Widget buildLongButtonInAResizableContainerUseCase(BuildContext context) { ), ), ); -} \ No newline at end of file +} diff --git a/widgetbook/lib/atoms/profile_tab_item.dart b/widgetbook/lib/atoms/profile_tab_item.dart index 68d94de2..557f8d08 100644 --- a/widgetbook/lib/atoms/profile_tab_item.dart +++ b/widgetbook/lib/atoms/profile_tab_item.dart @@ -7,7 +7,12 @@ import 'package:sparksocial/src/core/design_system/components/atoms/icons.dart'; Widget buildProfileTabItemSelectedUseCase(BuildContext context) { return Container( color: Theme.of(context).colorScheme.surface, - child: ProfileTabItem(icon: AppIcons.grid(), filledIcon: AppIcons.gridFilled(), isSelected: true, onTap: () => print('Tab tapped')), + child: ProfileTabItem( + icon: AppIcons.grid(), + filledIcon: AppIcons.gridFilled(), + isSelected: true, + onTap: () => print('Tab tapped'), + ), ); } @@ -31,10 +36,12 @@ Widget buildProfileTabItemInteractiveUseCase(BuildContext context) { class _InteractiveProfileTabItemDemo extends StatefulWidget { @override - State<_InteractiveProfileTabItemDemo> createState() => _InteractiveProfileTabItemDemoState(); + State<_InteractiveProfileTabItemDemo> createState() => + _InteractiveProfileTabItemDemoState(); } -class _InteractiveProfileTabItemDemoState extends State<_InteractiveProfileTabItemDemo> { +class _InteractiveProfileTabItemDemoState + extends State<_InteractiveProfileTabItemDemo> { bool _isSelected = false; @override @@ -54,7 +61,10 @@ class _InteractiveProfileTabItemDemoState extends State<_InteractiveProfileTabIt }, ), const SizedBox(height: 16), - Text('Status: ${_isSelected ? "Selected" : "Unselected"}', style: Theme.of(context).textTheme.bodyMedium), + Text( + 'Status: ${_isSelected ? "Selected" : "Unselected"}', + style: Theme.of(context).textTheme.bodyMedium, + ), ], ), ); @@ -113,7 +123,10 @@ class _MultipleTabsDemoState extends State<_MultipleTabsDemo> { ], ), const SizedBox(height: 16), - Text('Selected tab: $_selectedIndex', style: Theme.of(context).textTheme.bodyMedium), + Text( + 'Selected tab: $_selectedIndex', + style: Theme.of(context).textTheme.bodyMedium, + ), ], ), ); diff --git a/widgetbook/lib/main.dart b/widgetbook/lib/main.dart index fb8edeb7..68a8c3c5 100644 --- a/widgetbook/lib/main.dart +++ b/widgetbook/lib/main.dart @@ -4,4 +4,4 @@ import 'package:widgetbook_workspace/widgetbook.dart'; // no main = no custom fonts hahaha void main() { runApp(const WidgetbookApp()); -} \ No newline at end of file +} diff --git a/widgetbook/lib/molecules/glass_input.dart b/widgetbook/lib/molecules/glass_input.dart index 3ce68255..71048d0a 100644 --- a/widgetbook/lib/molecules/glass_input.dart +++ b/widgetbook/lib/molecules/glass_input.dart @@ -6,22 +6,46 @@ import 'package:sparksocial/src/core/design_system/components/molecules/glass_in import 'package:widgetbook/widgetbook.dart'; import 'package:widgetbook_annotation/widgetbook_annotation.dart'; -final _chatControllerProvider = Provider.autoDispose((ref) { +final _chatControllerProvider = Provider.autoDispose(( + ref, +) { final c = TextEditingController(); ref.onDispose(c.dispose); return c; }); -final _chatMessagesProvider = StateProvider.autoDispose>((_) => const []); +final _chatMessagesProvider = StateProvider.autoDispose>( + (_) => const [], +); @UseCase(name: 'comment', type: GlassInput) Widget buildGlassInputCommentUseCase(BuildContext context) { return Center( child: Container( - constraints: BoxConstraints(maxWidth: context.knobs.double.slider(label: 'width', initialValue: 210, min: 160, max: 400, divisions: 24)), + constraints: BoxConstraints( + maxWidth: context.knobs.double.slider( + label: 'width', + initialValue: 210, + min: 160, + max: 400, + divisions: 24, + ), + ), child: GlassInput.comment( - hintText: context.knobs.string(label: 'hint', initialValue: 'Add a comment...'), - leadingWidgets: [if (context.knobs.boolean(label: 'show_avatar', initialValue: true)) const CircleAvatar(radius: 10)], - actionWidgets: [if (context.knobs.boolean(label: 'show_action_icon', initialValue: true)) AppIcons.smiley()], + hintText: context.knobs.string( + label: 'hint', + initialValue: 'Add a comment...', + ), + leadingWidgets: [ + if (context.knobs.boolean(label: 'show_avatar', initialValue: true)) + const CircleAvatar(radius: 10), + ], + actionWidgets: [ + if (context.knobs.boolean( + label: 'show_action_icon', + initialValue: true, + )) + AppIcons.smiley(), + ], ), ), ); @@ -31,10 +55,21 @@ Widget buildGlassInputCommentUseCase(BuildContext context) { Widget buildGlassInputSearchUseCase(BuildContext context) { return Center( child: SizedBox( - width: context.knobs.double.slider(label: 'width', initialValue: 280, min: 160, max: 400, divisions: 24), + width: context.knobs.double.slider( + label: 'width', + initialValue: 280, + min: 160, + max: 400, + divisions: 24, + ), child: GlassInput.search( - hintText: context.knobs.string(label: 'hint', initialValue: 'Search...'), - leadingWidgets: [const Icon(Icons.search, size: 18, color: Colors.white70)], + hintText: context.knobs.string( + label: 'hint', + initialValue: 'Search...', + ), + leadingWidgets: [ + const Icon(Icons.search, size: 18, color: Colors.white70), + ], actionWidgets: [ if (context.knobs.boolean(label: 'show_clear', initialValue: true)) GestureDetector( @@ -53,7 +88,10 @@ Widget buildGlassInputChatInteractiveUseCase(BuildContext context) { child: Center( child: _ChatDemo( showSend: context.knobs.boolean(label: 'show_send', initialValue: true), - placeholder: context.knobs.string(label: 'hint', initialValue: 'Message...'), + placeholder: context.knobs.string( + label: 'hint', + initialValue: 'Message...', + ), ), ), ); @@ -90,10 +128,22 @@ class _ChatDemo extends ConsumerWidget { child: Padding( padding: const EdgeInsets.symmetric(vertical: 2), child: DecoratedBox( - decoration: BoxDecoration(color: Colors.white.withAlpha(30), borderRadius: BorderRadius.circular(8)), + decoration: BoxDecoration( + color: Colors.white.withAlpha(30), + borderRadius: BorderRadius.circular(8), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), - child: Text(msg, style: const TextStyle(fontSize: 11, color: Colors.white)), + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Text( + msg, + style: const TextStyle( + fontSize: 11, + color: Colors.white, + ), + ), ), ), ), @@ -108,12 +158,17 @@ class _ChatDemo extends ConsumerWidget { child: GlassInput.chat( controller: controller, hintText: placeholder, - leadingWidgets: const [Icon(Icons.chat_bubble_outline, size: 18, color: Colors.white70)], + leadingWidgets: const [ + Icon(Icons.chat_bubble_outline, size: 18, color: Colors.white70), + ], onSendMessage: showSend ? () { final text = controller.text.trim(); if (text.isEmpty) return; - ref.read(_chatMessagesProvider.notifier).state = [...messages, text]; + ref.read(_chatMessagesProvider.notifier).state = [ + ...messages, + text, + ]; controller.clear(); } : null, diff --git a/widgetbook/lib/molecules/post_tile.dart b/widgetbook/lib/molecules/post_tile.dart index e4a39c06..a3591f1c 100644 --- a/widgetbook/lib/molecules/post_tile.dart +++ b/widgetbook/lib/molecules/post_tile.dart @@ -9,11 +9,29 @@ const _demoThumbnail = 'https://picsum.photos/400/600'; Widget buildPostTileUseCase(BuildContext context) { return Center( child: SizedBox( - width: context.knobs.double.slider(label: 'width', initialValue: 150, min: 100, max: 300), - height: context.knobs.double.slider(label: 'height', initialValue: 200, min: 150, max: 400), + width: context.knobs.double.slider( + label: 'width', + initialValue: 150, + min: 100, + max: 300, + ), + height: context.knobs.double.slider( + label: 'height', + initialValue: 200, + min: 150, + max: 400, + ), child: PostTile( - thumbnailUrl: context.knobs.string(label: 'thumbnailUrl', initialValue: _demoThumbnail), - likes: context.knobs.int.slider(label: 'likes', initialValue: 1239, min: 0, max: 100000), + thumbnailUrl: context.knobs.string( + label: 'thumbnailUrl', + initialValue: _demoThumbnail, + ), + likes: context.knobs.int.slider( + label: 'likes', + initialValue: 1239, + min: 0, + max: 100000, + ), seen: context.knobs.boolean(label: 'seen', initialValue: false), nsfwBlur: context.knobs.boolean(label: 'nsfwBlur', initialValue: false), onTap: () => print('PostTile tapped'), @@ -30,7 +48,12 @@ Widget buildPostTileSeenUseCase(BuildContext context) { height: 200, child: PostTile( thumbnailUrl: _demoThumbnail, - likes: context.knobs.int.slider(label: 'likes', initialValue: 5420, min: 0, max: 100000), + likes: context.knobs.int.slider( + label: 'likes', + initialValue: 5420, + min: 0, + max: 100000, + ), seen: true, nsfwBlur: false, onTap: () => print('Seen PostTile tapped'), diff --git a/widgetbook/lib/tokens/colors.dart b/widgetbook/lib/tokens/colors.dart index 93a1d851..3b00eb16 100644 --- a/widgetbook/lib/tokens/colors.dart +++ b/widgetbook/lib/tokens/colors.dart @@ -4,10 +4,7 @@ import 'package:widgetbook_annotation/widgetbook_annotation.dart'; import 'package:sparksocial/src/core/design_system/tokens/colors.dart'; import 'package:widgetbook_workspace/tokens/colors_preview.dart'; -@UseCase( - name: 'Default', - type: AppColors, -) +@UseCase(name: 'Default', type: AppColors) Widget buildAppColorsUseCase(BuildContext context) { return const Padding( padding: EdgeInsets.all(24), @@ -96,7 +93,7 @@ Widget buildAppColorsUseCase(BuildContext context) { AppColors.rajah900, ], ), - SizedBox(height: 24), + SizedBox(height: 24), ColorPalettePreview( name: 'Indigo', colors: [ @@ -112,7 +109,7 @@ Widget buildAppColorsUseCase(BuildContext context) { AppColors.indigo900, ], ), - SizedBox(height: 24), + SizedBox(height: 24), ColorPalettePreview( name: 'Blue', colors: [ @@ -128,8 +125,8 @@ Widget buildAppColorsUseCase(BuildContext context) { AppColors.blue900, ], ), - SizedBox(height: 24), - ColorPalettePreview( + SizedBox(height: 24), + ColorPalettePreview( name: 'Red', colors: [ AppColors.red50, @@ -144,8 +141,8 @@ Widget buildAppColorsUseCase(BuildContext context) { AppColors.red900, ], ), - SizedBox(height: 24), - ColorPalettePreview( + SizedBox(height: 24), + ColorPalettePreview( name: 'Green', colors: [ AppColors.green50, diff --git a/widgetbook/lib/tokens/typography_preview.dart b/widgetbook/lib/tokens/typography_preview.dart index 12489982..443f206e 100644 --- a/widgetbook/lib/tokens/typography_preview.dart +++ b/widgetbook/lib/tokens/typography_preview.dart @@ -19,18 +19,11 @@ class TypographyPreview extends StatelessWidget { opacity: 0.64, child: Text( name.toUpperCase(), - style: const TextStyle( - fontSize: 11, - fontWeight: FontWeight.w200, - ), + style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w200), ), ), - for (final style in styles.entries) - Text( - style.key, - style: style.value, - ), + for (final style in styles.entries) Text(style.key, style: style.value), ], ); } -} \ No newline at end of file +} diff --git a/widgetbook/lib/widgetbook_usecases_templates.dart b/widgetbook/lib/widgetbook_usecases_templates.dart index e1d9cd7c..f62ec9f3 100644 --- a/widgetbook/lib/widgetbook_usecases_templates.dart +++ b/widgetbook/lib/widgetbook_usecases_templates.dart @@ -40,7 +40,12 @@ Widget imageBackground({required BuildContext context, required Widget child}) { ); } -Widget gradientBackground({required BuildContext context, required Widget child, required Color startColor, required Color endColor}) { +Widget gradientBackground({ + required BuildContext context, + required Widget child, + required Color startColor, + required Color endColor, +}) { return _BackgroundWrapper( background: Container( decoration: BoxDecoration( @@ -55,9 +60,13 @@ Widget gradientBackground({required BuildContext context, required Widget child, ); } -Widget solidColorBackground({required BuildContext context, required Widget child, required Color color}) { +Widget solidColorBackground({ + required BuildContext context, + required Widget child, + required Color color, +}) { return _BackgroundWrapper( background: Container(color: color), child: Center(child: child), ); -} \ No newline at end of file +} -- 2.51.2