barcode_scanner/lib/components/main_appbar_component.dart
mandreshope 8252cf0b22 feat: Adds stock picking detail view and API call
Implements a dedicated page for viewing detailed stock picking information.

- Introduces `getStockPikingById` API call to fetch a single stock picking record by ID.
- Enhances `MainAppbarComponent` to support customizable leading widgets, enabling a back button on detail pages.
- Improves `QuickActionComponent` by allowing optional `onTap` callbacks for actions, making buttons conditionally visible and reusable across different contexts.
- Adds `margin` property to `StockPickingCard` for flexible layout adjustments.
- Refactors `ReceptionDetailsPage` to utilize the new API call and display a single stock picking's details, adapting its app bar and quick actions accordingly.
2025-07-29 14:43:43 +03:00

62 lines
1.7 KiB
Dart

import 'package:barcode_scanner/themes/app_theme.dart';
import 'package:flutter/material.dart';
class MainAppbarComponent extends StatelessWidget
implements PreferredSizeWidget {
const MainAppbarComponent({
super.key,
this.title,
this.subTitle,
this.scaffoledKey,
this.leading,
});
final GlobalKey<ScaffoldState>? scaffoledKey;
final String? title;
final String? subTitle;
final Widget? leading;
@override
Widget build(BuildContext context) {
return AppBar(
leading:
leading ??
IconButton(
icon: Icon(Icons.menu, color: AppTheme.of(context).white),
onPressed: () {
scaffoledKey?.currentState?.openDrawer();
},
),
title: title == null || subTitle == null
? null
: Row(
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title ?? '',
style: AppTheme.of(
context,
).titleMedium.copyWith(color: AppTheme.of(context).white),
),
Text(
subTitle ?? '',
style: AppTheme.of(
context,
).bodyMedium.copyWith(color: AppTheme.of(context).white),
),
],
),
],
),
toolbarHeight: 60,
backgroundColor: AppTheme.of(context).primary,
elevation: 4,
);
}
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight);
}