barcode_scanner/lib/components/primary_button_component.dart
mandreshope 27863f800e style: Applies global theme and refines Reception page UI
Integrates `AppTheme` for consistent styling across the Reception page, affecting backgrounds, app bar, cards, and text.

Enhances `PrimaryButtonComponent` to support leading icons and centered content, and introduces `OutlineButtonComponent` for secondary actions, standardizing button usage.

Improves the AppBar by adding a drawer toggle and updating the title layout and styling. Removes the bottom navigation bar to streamline page navigation.
2025-07-24 09:05:43 +03:00

56 lines
1.6 KiB
Dart

import 'package:barcode_scanner/components/loading_progress_component.dart';
import 'package:barcode_scanner/themes/app_theme.dart';
import 'package:flutter/material.dart';
class PrimaryButtonComponent extends StatelessWidget {
const PrimaryButtonComponent({
super.key,
required this.text,
required this.onPressed,
this.loading = false,
this.leading,
this.centered = false,
});
final void Function()? onPressed;
final String text;
final bool loading;
final Widget? leading;
final bool centered;
@override
Widget build(BuildContext context) {
final textWidget = Text(
text,
style: TextStyle(
fontWeight: FontWeight.bold,
color: AppTheme.of(context).white,
),
);
return ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.of(context).primary,
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
onPressed: loading ? null : onPressed,
child: loading
? SizedBox(
height: 20,
width: 20,
child: Center(
child: LoadingProgressComponent(
color: AppTheme.of(context).primary,
),
),
)
: leading == null
? textWidget
: Row(
mainAxisSize: centered ? MainAxisSize.min : MainAxisSize.max,
spacing: 10,
children: [?leading, textWidget],
),
);
}
}