-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): #15 skeleton create tontine
- Loading branch information
1 parent
69d65b0
commit bd418cc
Showing
6 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
lib/presentation/controllers/create_tontine_controller.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:get/get.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class CreateTontineController extends GetxController { | ||
var tontineName = ''.obs; | ||
var individualAmount = ''.obs; | ||
var numberOfMembers = ''.obs; | ||
var penalty = 'Casier de bieres'.obs; | ||
var frequency = 'Toutes les semaines'.obs; | ||
|
||
final tontineNameController = TextEditingController(); | ||
final individualAmountController = TextEditingController(); | ||
final numberOfMembersController = TextEditingController(); | ||
final penaltyController = TextEditingController(); | ||
|
||
@override | ||
void onClose() { | ||
tontineNameController.dispose(); | ||
individualAmountController.dispose(); | ||
numberOfMembersController.dispose(); | ||
penaltyController.dispose(); | ||
super.onClose(); | ||
} | ||
|
||
void updateFrequency(String value) { | ||
frequency.value = value; | ||
} | ||
|
||
void submit() { | ||
print("Tontine Name: ${tontineNameController.text}"); | ||
print("Individual Amount: ${individualAmountController.text}"); | ||
print("Number of Members: ${numberOfMembersController.text}"); | ||
print("Penalty: ${penalty.value}"); | ||
print("Frequency: ${frequency.value}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export './authentification/auth_controller.dart'; | ||
export './create_association_controller.dart'; | ||
export './user_controller.dart'; | ||
export './association_page_controller.dart'; | ||
export './association_page_controller.dart'; | ||
export './create_tontine_controller.dart'; |
157 changes: 157 additions & 0 deletions
157
lib/presentation/pages/create_tontine/create_tontine_page.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import 'package:get/get.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:manzon/app/core/utils/screen_util.dart'; | ||
import 'package:manzon/presentation/widgets/export_widget.dart'; | ||
import 'package:manzon/app/config/theme/export_theme_manager.dart'; | ||
import 'package:manzon/presentation/controllers/create_tontine_controller.dart'; | ||
|
||
class CreateTontinePage extends StatefulWidget { | ||
@override | ||
State<CreateTontinePage> createState() => _CreateTontinePageState(); | ||
} | ||
|
||
class _CreateTontinePageState extends State<CreateTontinePage> { | ||
final CreateTontineController controller = Get.put(CreateTontineController()); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Creer une tontine'), | ||
backgroundColor: AppColors.white, | ||
leading: IconButton( | ||
icon: Icon(Icons.arrow_back, color: AppColors.blackNormal), | ||
onPressed: () => Navigator.of(context).pop(), | ||
), | ||
), | ||
body: Padding( | ||
padding: EdgeInsets.all(ScreenSize.horizontalPadding), | ||
child: SingleChildScrollView( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text('Quel est le nom de la tontine?', | ||
style: getMediumStyle( | ||
color: AppColors.blackNormal, fontSize: FontSize.s16)), | ||
TextFieldWidget( | ||
prefixIcon: Icons.location_city, | ||
hintText: "Nom de la tontine".tr, | ||
controller: controller.tontineNameController, | ||
isPassword: false, | ||
keyboardType: TextInputType.text, | ||
readOnly: false, | ||
), | ||
SizedBox(height: AppSize.s16), | ||
Text('Montant individuel', | ||
style: getMediumStyle( | ||
color: AppColors.blackNormal, fontSize: FontSize.s16)), | ||
TextFieldWidget( | ||
prefixIcon: Icons.money, | ||
hintText: "10000 Fcfa".tr, | ||
controller: controller.individualAmountController, | ||
isPassword: false, | ||
keyboardType: TextInputType.number, | ||
readOnly: false, | ||
), | ||
SizedBox(height: AppSize.s16), | ||
Text('Nombre de membre', | ||
style: getMediumStyle( | ||
color: AppColors.blackNormal, fontSize: FontSize.s16)), | ||
TextFieldWidget( | ||
prefixIcon: Icons.numbers, | ||
hintText: "10".tr, | ||
controller: controller.numberOfMembersController, | ||
isPassword: false, | ||
keyboardType: TextInputType.number, | ||
readOnly: false, | ||
), | ||
SizedBox(height: AppSize.s16), | ||
Text('Amande en cas d\'echec', | ||
style: getMediumStyle( | ||
color: AppColors.blackNormal, fontSize: FontSize.s16)), | ||
DropdownButtonFormField<String>( | ||
value: controller.penalty.value, | ||
items: [ | ||
DropdownMenuItem( | ||
value: 'Casier de bieres', | ||
child: Text('Casier de bieres'), | ||
), | ||
DropdownMenuItem( | ||
value: 'Montant fixe', | ||
child: Text('Montant fixe'), | ||
), | ||
], | ||
onChanged: (value) { | ||
controller.penalty.value = value!; | ||
}, | ||
decoration: InputDecoration( | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(8), | ||
), | ||
), | ||
), | ||
SizedBox(height: AppSize.s16), | ||
Text('Frequence de bouffe', | ||
style: getMediumStyle( | ||
color: AppColors.blackNormal, fontSize: FontSize.s16)), | ||
Column( | ||
children: [ | ||
Obx(() => Row( | ||
children: [ | ||
Radio<String>( | ||
value: 'Toutes les semaines', | ||
groupValue: controller.frequency.value, | ||
onChanged: (value) { | ||
controller.updateFrequency(value!); | ||
}, | ||
), | ||
Text('Toutes les semaines'), | ||
], | ||
)), | ||
Obx(() => Row( | ||
children: [ | ||
Radio<String>( | ||
value: 'Tous les mois', | ||
groupValue: controller.frequency.value, | ||
onChanged: (value) { | ||
controller.updateFrequency(value!); | ||
}, | ||
), | ||
Text('Tous les mois'), | ||
], | ||
)), | ||
], | ||
), | ||
SizedBox(height: AppSize.s16), | ||
TextButton.icon( | ||
onPressed: () { | ||
// Navigate to SelectContactsView to add members | ||
}, | ||
icon: Icon(Icons.person_add_alt), | ||
label: Text('Ajouter des membres', | ||
style: getMediumStyle( | ||
color: AppColors.primaryNormal, | ||
fontSize: FontSize.s16)), | ||
), | ||
SizedBox(height: AppSize.s16), | ||
], | ||
), | ||
), | ||
), | ||
bottomNavigationBar: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: DefaultButton( | ||
onTap: () { | ||
// Handle form submission | ||
controller.submit(); | ||
}, | ||
backgroundColor: AppColors.primaryNormal, | ||
text: 'Continuer', | ||
width: double.infinity, | ||
fontWeight: FontWeight.w600, | ||
borderRadius: 50.0, | ||
), | ||
), | ||
); | ||
} | ||
} |