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/services/chit_group_service.dart';
|
||||||
import '../../core/models/chit_group.dart';
|
import '../../core/models/chit_group.dart';
|
||||||
import 'create_group_dialog.dart';
|
import 'create_group_dialog.dart';
|
||||||
|
import 'import_existing_group_dialog.dart';
|
||||||
import 'member_selection_dialog.dart';
|
import 'member_selection_dialog.dart';
|
||||||
import 'group_details_page.dart';
|
import 'group_details_page.dart';
|
||||||
import 'combined_draw_dialog.dart';
|
import 'combined_draw_dialog.dart';
|
||||||
|
|
@ -27,9 +28,37 @@ class ChitGroupsPage extends StatelessWidget {
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
PopupMenuButton<String>(
|
||||||
icon: Icon(Icons.add, size: 24.w),
|
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),
|
SizedBox(height: 12.h),
|
||||||
Text(
|
Text(
|
||||||
'Create your first chit group to get started',
|
'Create a new chit group or import an existing one',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.sp,
|
fontSize: 16.sp,
|
||||||
color: Colors.grey.shade500,
|
color: Colors.grey.shade500,
|
||||||
|
|
@ -71,21 +100,43 @@ class ChitGroupsPage extends StatelessWidget {
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
SizedBox(height: 32.h),
|
SizedBox(height: 32.h),
|
||||||
ElevatedButton.icon(
|
Row(
|
||||||
onPressed: () => _showCreateGroupDialog(context),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
icon: Icon(Icons.add, size: 20.w),
|
children: [
|
||||||
label: Text(
|
ElevatedButton.icon(
|
||||||
'Create Group',
|
onPressed: () => _showCreateGroupDialog(context),
|
||||||
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w500),
|
icon: Icon(Icons.add, size: 20.w),
|
||||||
),
|
label: Text(
|
||||||
style: ElevatedButton.styleFrom(
|
'Create New',
|
||||||
backgroundColor: Colors.green.shade600,
|
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w500),
|
||||||
foregroundColor: Colors.white,
|
),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h),
|
style: ElevatedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
backgroundColor: Colors.green.shade600,
|
||||||
borderRadius: BorderRadius.circular(12.r),
|
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) {
|
void _showAddMemberDialog(BuildContext context, ChitGroup group) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ class _ImportExistingGroupDialogState extends State<ImportExistingGroupDialog> {
|
||||||
|
|
||||||
DateTime? _selectedStartDate;
|
DateTime? _selectedStartDate;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
int _step = 1; // Multi-step wizard
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue