From 7259aa41fdd550603c05e9b7efedc45e40717f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Sun, 11 Jan 2026 02:14:51 +0100 Subject: [PATCH] Fix org creation dialog, document viewer colors, and font errors --- b0esche_cloud/lib/main.dart | 8 +- b0esche_cloud/lib/pages/document_viewer.dart | 22 ++- b0esche_cloud/lib/pages/home_page.dart | 154 +++++++++++++------ b0esche_cloud/pubspec.yaml | 5 - 4 files changed, 130 insertions(+), 59 deletions(-) diff --git a/b0esche_cloud/lib/main.dart b/b0esche_cloud/lib/main.dart index b602472..7f85d35 100644 --- a/b0esche_cloud/lib/main.dart +++ b/b0esche_cloud/lib/main.dart @@ -94,7 +94,13 @@ class _MainAppState extends State { return MaterialApp( theme: AppTheme.darkTheme, home: const Scaffold( - body: Center(child: CircularProgressIndicator()), + body: Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation( + AppTheme.accentColor, + ), + ), + ), ), ); } diff --git a/b0esche_cloud/lib/pages/document_viewer.dart b/b0esche_cloud/lib/pages/document_viewer.dart index a0b2388..43b89f7 100644 --- a/b0esche_cloud/lib/pages/document_viewer.dart +++ b/b0esche_cloud/lib/pages/document_viewer.dart @@ -132,7 +132,16 @@ class _DocumentViewerModalState extends State { child: BlocBuilder( builder: (context, state) { if (state is DocumentViewerLoading) { - return const Center(child: CircularProgressIndicator()); + return Container( + color: AppTheme.primaryBackground, + child: const Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation( + AppTheme.accentColor, + ), + ), + ), + ); } if (state is DocumentViewerError) { return Center( @@ -300,7 +309,16 @@ class _DocumentViewerState extends State { body: BlocBuilder( builder: (context, state) { if (state is DocumentViewerLoading) { - return const Center(child: CircularProgressIndicator()); + return Container( + color: AppTheme.primaryBackground, + child: const Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation( + AppTheme.accentColor, + ), + ), + ), + ); } if (state is DocumentViewerError) { return Center(child: Text('Error: ${state.message}')); diff --git a/b0esche_cloud/lib/pages/home_page.dart b/b0esche_cloud/lib/pages/home_page.dart index 4c14ed9..d24eab4 100644 --- a/b0esche_cloud/lib/pages/home_page.dart +++ b/b0esche_cloud/lib/pages/home_page.dart @@ -96,61 +96,113 @@ class _HomePageState extends State with TickerProviderStateMixin { child: Container( padding: const EdgeInsets.all(24), decoration: AppTheme.glassDecoration, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - 'Create New Organization', - style: TextStyle( - color: AppTheme.primaryText, - fontSize: 18, - fontWeight: FontWeight.bold, + child: BlocListener( + listener: (context, state) { + if (state is OrganizationLoaded && !state.isLoading) { + if (state.error == null) { + // Success - close dialog + Navigator.of(context).pop(); + }\n } + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + 'Create New Organization', + style: TextStyle( + color: AppTheme.primaryText, + fontSize: 18, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 16), - TextField( - cursorColor: AppTheme.accentColor, - controller: controller, - style: TextStyle(color: AppTheme.primaryText), - decoration: InputDecoration( - labelText: 'Organization Name', - labelStyle: TextStyle(color: AppTheme.secondaryText), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide( - color: AppTheme.accentColor.withValues(alpha: 0.5), + const SizedBox(height: 16), + TextField( + cursorColor: AppTheme.accentColor, + controller: controller, + style: TextStyle(color: AppTheme.primaryText), + decoration: InputDecoration( + labelText: 'Organization Name', + labelStyle: TextStyle(color: AppTheme.secondaryText), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + borderSide: BorderSide( + color:\n AppTheme.accentColor.withValues(alpha: 0.5), + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + borderSide:\n BorderSide(color: AppTheme.accentColor), ), ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: AppTheme.accentColor), - ), + onSubmitted: (value) { + final name = controller.text.trim(); + if (name.isNotEmpty) { + BlocProvider.of( + context, + ).add(CreateOrganization(name)); + } + }, ), - ), - const SizedBox(height: 24), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ModernGlassButton( - onPressed: () => Navigator.of(context).pop(), - child: const Text('Cancel'), - ), - const SizedBox(width: 16), - ModernGlassButton( - onPressed: () { - final name = controller.text.trim(); - if (name.isNotEmpty) { - BlocProvider.of( - context, - ).add(CreateOrganization(name)); - Navigator.of(context).pop(); - } - }, - child: const Text('Create'), - ), - ], - ), - ], + const SizedBox(height: 24), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ModernGlassButton( + onPressed: () => Navigator.of(context).pop(), + child: const Text('Cancel'), + ), + const SizedBox(width: 16), + BlocBuilder( + builder: (context, state) { + final isLoading = state is OrganizationLoaded && + state.isLoading; + return ModernGlassButton( + onPressed: isLoading + ? null + : () { + final name = controller.text.trim(); + if (name.isNotEmpty) { + BlocProvider.of( + context, + ).add(CreateOrganization(name)); + } + }, + child: isLoading + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor:\n AlwaysStoppedAnimation( + AppTheme.accentColor, + ), + ), + ) + : const Text('Create'), + ); + }, + ), + ], + ), + const SizedBox(height: 8), + // Error message + BlocBuilder( + builder: (context, state) { + if (state is OrganizationLoaded && + state.error != null) { + return Text( + state.error!, + style: const TextStyle( + color: Colors.red, + fontSize: 12, + ), + ); + } + return const SizedBox.shrink(); + }, + ), + ], + ), ), ), ), diff --git a/b0esche_cloud/pubspec.yaml b/b0esche_cloud/pubspec.yaml index 4ff331a..504aa18 100644 --- a/b0esche_cloud/pubspec.yaml +++ b/b0esche_cloud/pubspec.yaml @@ -76,8 +76,3 @@ flutter: assets: - assets/fonts/ - - fonts: - - family: PixelatedElegance - fonts: - - asset: assets/fonts/pixelated-elegance/PixelatedEleganceRegular-ovyAA.ttf