import button
This commit is contained in:
parent
9e9aaf7a07
commit
703fd1f461
|
|
@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||
import '../../core/services/chit_group_service.dart';
|
||||
import '../../core/models/chit_group.dart';
|
||||
import 'create_group_dialog.dart';
|
||||
import 'import_existing_group_dialog.dart';
|
||||
import 'member_selection_dialog.dart';
|
||||
import 'group_details_page.dart';
|
||||
import 'combined_draw_dialog.dart';
|
||||
|
|
@ -27,9 +28,37 @@ class ChitGroupsPage extends StatelessWidget {
|
|||
foregroundColor: Colors.white,
|
||||
elevation: 2,
|
||||
actions: [
|
||||
IconButton(
|
||||
PopupMenuButton<String>(
|
||||
icon: Icon(Icons.add, size: 24.w),
|
||||
onPressed: () => _showCreateGroupDialog(context),
|
||||
onSelected: (value) {
|
||||
if (value == 'create') {
|
||||
_showCreateGroupDialog(context);
|
||||
} else if (value == 'import') {
|
||||
_showImportGroupDialog(context);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: 'create',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.add_circle, color: Colors.green.shade600, size: 20.w),
|
||||
SizedBox(width: 12.w),
|
||||
const Text('Create New Group'),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'import',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.upload, color: Colors.blue.shade600, size: 20.w),
|
||||
SizedBox(width: 12.w),
|
||||
const Text('Import Existing Group'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -63,7 +92,7 @@ class ChitGroupsPage extends StatelessWidget {
|
|||
),
|
||||
SizedBox(height: 12.h),
|
||||
Text(
|
||||
'Create your first chit group to get started',
|
||||
'Create a new chit group or import an existing one',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.grey.shade500,
|
||||
|
|
@ -71,21 +100,43 @@ class ChitGroupsPage extends StatelessWidget {
|
|||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 32.h),
|
||||
ElevatedButton.icon(
|
||||
onPressed: () => _showCreateGroupDialog(context),
|
||||
icon: Icon(Icons.add, size: 20.w),
|
||||
label: Text(
|
||||
'Create Group',
|
||||
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w500),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green.shade600,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.r),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton.icon(
|
||||
onPressed: () => _showCreateGroupDialog(context),
|
||||
icon: Icon(Icons.add, size: 20.w),
|
||||
label: Text(
|
||||
'Create New',
|
||||
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w500),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green.shade600,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.r),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => _showImportGroupDialog(context),
|
||||
icon: Icon(Icons.upload, size: 20.w),
|
||||
label: Text(
|
||||
'Import Existing',
|
||||
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w500),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Colors.blue.shade600,
|
||||
side: BorderSide(color: Colors.blue.shade600, width: 2),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.r),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -395,6 +446,19 @@ class ChitGroupsPage extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
void _showImportGroupDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => const ImportExistingGroupDialog(),
|
||||
).then((result) {
|
||||
if (result == true) {
|
||||
// Reload groups after successful import
|
||||
ChitGroupService.to.loadManagerChitGroups();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _showAddMemberDialog(BuildContext context, ChitGroup group) {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class _ImportExistingGroupDialogState extends State<ImportExistingGroupDialog> {
|
|||
|
||||
DateTime? _selectedStartDate;
|
||||
bool _isLoading = false;
|
||||
int _step = 1; // Multi-step wizard
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue