add dashboard to phone app
This commit is contained in:
@@ -5,6 +5,8 @@ import '../providers/dashboard_providers.dart';
|
||||
import '../../../widgets/loading_list.dart';
|
||||
import '../../../widgets/error_view.dart';
|
||||
import '../../../widgets/status_badge.dart';
|
||||
import 'dashboard_shell.dart';
|
||||
import 'customer_form_screen.dart';
|
||||
|
||||
class CustomersScreen extends ConsumerStatefulWidget {
|
||||
const CustomersScreen({super.key});
|
||||
@@ -24,16 +26,25 @@ class _CustomersScreenState extends ConsumerState<CustomersScreen> {
|
||||
}
|
||||
|
||||
Map<String, dynamic> get _params => {
|
||||
'page': 1,
|
||||
'pageSize': 50,
|
||||
if (_search.isNotEmpty) 'search': _search,
|
||||
};
|
||||
'page': 1,
|
||||
'pageSize': 50,
|
||||
if (_search.isNotEmpty) 'search': _search,
|
||||
};
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final customersAsync = ref.watch(customersProvider(_params));
|
||||
|
||||
return Scaffold(
|
||||
return DashboardShell(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final result = await Navigator.of(context).push<bool>(
|
||||
MaterialPageRoute(builder: (_) => const CustomerFormScreen()),
|
||||
);
|
||||
if (result == true) ref.invalidate(customersProvider(_params));
|
||||
},
|
||||
child: const Icon(Icons.person_add_outlined),
|
||||
),
|
||||
appBar: AppBar(
|
||||
title: const Text('Customers'),
|
||||
bottom: PreferredSize(
|
||||
@@ -60,8 +71,11 @@ class _CustomersScreenState extends ConsumerState<CustomersScreen> {
|
||||
),
|
||||
data: (res) => res.data.isEmpty
|
||||
? const Center(
|
||||
child: Text('No customers found',
|
||||
style: TextStyle(color: Color(0xFF9CA3AF))))
|
||||
child: Text(
|
||||
'No customers found',
|
||||
style: TextStyle(color: Color(0xFF9CA3AF)),
|
||||
),
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: () async =>
|
||||
ref.invalidate(customersProvider(_params)),
|
||||
@@ -98,8 +112,7 @@ class _CustomersScreenState extends ConsumerState<CustomersScreen> {
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
@@ -111,9 +124,11 @@ class _CustomersScreenState extends ConsumerState<CustomersScreen> {
|
||||
),
|
||||
if (c.isFlagged) ...[
|
||||
const SizedBox(width: 6),
|
||||
const Icon(Icons.flag,
|
||||
size: 14,
|
||||
color: Color(0xFFE02424)),
|
||||
const Icon(
|
||||
Icons.flag,
|
||||
size: 14,
|
||||
color: Color(0xFFE02424),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user