
Corrects API endpoints for creating, processing with, and processing without backorder confirmations. Adds a new `isBackorder` getter to stock picking records for identifying backordered items, and improves the robustness of the `isDone` getter. Integrates backorder detection into the reception validation process, prompting a dedicated confirmation dialog when a backorder is present. Introduces new state management and methods (`withBackorder`, `withoutBackorder`) in the reception details model to handle the backorder confirmation logic. Enhances the primary button component with a `backgroundColor` property for greater customization.
58 lines
1.6 KiB
Dart
58 lines
1.6 KiB
Dart
import 'package:e_scan/components/loading_progress_component.dart';
|
|
import 'package:e_scan/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,
|
|
this.backgroundColor,
|
|
});
|
|
final void Function()? onPressed;
|
|
final String text;
|
|
final bool loading;
|
|
final Widget? leading;
|
|
final bool centered;
|
|
final Color? backgroundColor;
|
|
|
|
@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: 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],
|
|
),
|
|
);
|
|
}
|
|
}
|