Fix org creation dialog, document viewer colors, and font errors

This commit is contained in:
Leon Bösche
2026-01-11 02:14:51 +01:00
parent 9952323252
commit 7259aa41fd
4 changed files with 130 additions and 59 deletions

View File

@@ -94,7 +94,13 @@ class _MainAppState extends State<MainApp> {
return MaterialApp( return MaterialApp(
theme: AppTheme.darkTheme, theme: AppTheme.darkTheme,
home: const Scaffold( home: const Scaffold(
body: Center(child: CircularProgressIndicator()), body: Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
AppTheme.accentColor,
),
),
),
), ),
); );
} }

View File

@@ -132,7 +132,16 @@ class _DocumentViewerModalState extends State<DocumentViewerModal> {
child: BlocBuilder<DocumentViewerBloc, DocumentViewerState>( child: BlocBuilder<DocumentViewerBloc, DocumentViewerState>(
builder: (context, state) { builder: (context, state) {
if (state is DocumentViewerLoading) { if (state is DocumentViewerLoading) {
return const Center(child: CircularProgressIndicator()); return Container(
color: AppTheme.primaryBackground,
child: const Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
AppTheme.accentColor,
),
),
),
);
} }
if (state is DocumentViewerError) { if (state is DocumentViewerError) {
return Center( return Center(
@@ -300,7 +309,16 @@ class _DocumentViewerState extends State<DocumentViewer> {
body: BlocBuilder<DocumentViewerBloc, DocumentViewerState>( body: BlocBuilder<DocumentViewerBloc, DocumentViewerState>(
builder: (context, state) { builder: (context, state) {
if (state is DocumentViewerLoading) { if (state is DocumentViewerLoading) {
return const Center(child: CircularProgressIndicator()); return Container(
color: AppTheme.primaryBackground,
child: const Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
AppTheme.accentColor,
),
),
),
);
} }
if (state is DocumentViewerError) { if (state is DocumentViewerError) {
return Center(child: Text('Error: ${state.message}')); return Center(child: Text('Error: ${state.message}'));

View File

@@ -96,61 +96,113 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
child: Container( child: Container(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
decoration: AppTheme.glassDecoration, decoration: AppTheme.glassDecoration,
child: Column( child: BlocListener<OrganizationBloc, OrganizationState>(
mainAxisSize: MainAxisSize.min, listener: (context, state) {
children: [ if (state is OrganizationLoaded && !state.isLoading) {
Text( if (state.error == null) {
'Create New Organization', // Success - close dialog
style: TextStyle( Navigator.of(context).pop();
color: AppTheme.primaryText, }\n }
fontSize: 18, },
fontWeight: FontWeight.bold, child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Create New Organization',
style: TextStyle(
color: AppTheme.primaryText,
fontSize: 18,
fontWeight: FontWeight.bold,
),
), ),
), const SizedBox(height: 16),
const SizedBox(height: 16), TextField(
TextField( cursorColor: AppTheme.accentColor,
cursorColor: AppTheme.accentColor, controller: controller,
controller: controller, style: TextStyle(color: AppTheme.primaryText),
style: TextStyle(color: AppTheme.primaryText), decoration: InputDecoration(
decoration: InputDecoration( labelText: 'Organization Name',
labelText: 'Organization Name', labelStyle: TextStyle(color: AppTheme.secondaryText),
labelStyle: TextStyle(color: AppTheme.secondaryText), enabledBorder: OutlineInputBorder(
enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(8), borderSide: BorderSide(
borderSide: BorderSide( color:\n AppTheme.accentColor.withValues(alpha: 0.5),
color: AppTheme.accentColor.withValues(alpha: 0.5), ),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide:\n BorderSide(color: AppTheme.accentColor),
), ),
), ),
focusedBorder: OutlineInputBorder( onSubmitted: (value) {
borderRadius: BorderRadius.circular(8), final name = controller.text.trim();
borderSide: BorderSide(color: AppTheme.accentColor), if (name.isNotEmpty) {
), BlocProvider.of<OrganizationBloc>(
context,
).add(CreateOrganization(name));
}
},
), ),
), const SizedBox(height: 24),
const SizedBox(height: 24), Row(
Row( mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end, children: [
children: [ ModernGlassButton(
ModernGlassButton( onPressed: () => Navigator.of(context).pop(),
onPressed: () => Navigator.of(context).pop(), child: const Text('Cancel'),
child: const Text('Cancel'), ),
), const SizedBox(width: 16),
const SizedBox(width: 16), BlocBuilder<OrganizationBloc, OrganizationState>(
ModernGlassButton( builder: (context, state) {
onPressed: () { final isLoading = state is OrganizationLoaded &&
final name = controller.text.trim(); state.isLoading;
if (name.isNotEmpty) { return ModernGlassButton(
BlocProvider.of<OrganizationBloc>( onPressed: isLoading
context, ? null
).add(CreateOrganization(name)); : () {
Navigator.of(context).pop(); final name = controller.text.trim();
} if (name.isNotEmpty) {
}, BlocProvider.of<OrganizationBloc>(
child: const Text('Create'), context,
), ).add(CreateOrganization(name));
], }
), },
], child: isLoading
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor:\n AlwaysStoppedAnimation<Color>(
AppTheme.accentColor,
),
),
)
: const Text('Create'),
);
},
),
],
),
const SizedBox(height: 8),
// Error message
BlocBuilder<OrganizationBloc, OrganizationState>(
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();
},
),
],
),
), ),
), ),
), ),

View File

@@ -76,8 +76,3 @@ flutter:
assets: assets:
- assets/fonts/ - assets/fonts/
fonts:
- family: PixelatedElegance
fonts:
- asset: assets/fonts/pixelated-elegance/PixelatedEleganceRegular-ovyAA.ttf