Skip to content

Commit d190274

Browse files
committed
profile page update 2
1 parent 07a9051 commit d190274

File tree

9 files changed

+181
-76
lines changed

9 files changed

+181
-76
lines changed

lib/app/modules/profile/views/profile_view.dart

Lines changed: 73 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class ProfileView extends GetView<ProfileController> {
228228
},
229229
(profile) {
230230
String currentMode = controller.profilesWidget.getMode(profile);
231+
String? selectedMode = currentMode;
231232
showDialog(
232233
context: context,
233234
builder: (BuildContext context) {
@@ -238,46 +239,86 @@ class ProfileView extends GetView<ProfileController> {
238239
.sentences
239240
.profilePageChangeProfileMode,
240241
),
241-
content: Text(SentenceManager(
242-
currentLanguage: AppSettings.selectedLanguage)
243-
.sentences
244-
.profilePageSelectProfileMode),
242+
// Use StatefulBuilder to manage the state of the radio buttons inside the dialog
243+
content: StatefulBuilder(
244+
builder: (BuildContext context, StateSetter setState) {
245+
return Column(
246+
mainAxisSize: MainAxisSize.min, // Use minimum space
247+
children: <Widget>[
248+
RadioListTile<String>(
249+
title: const Text('CCSync'),
250+
value: 'TW3',
251+
groupValue: selectedMode,
252+
onChanged: (String? value) {
253+
setState(() {
254+
selectedMode = value;
255+
});
256+
},
257+
),
258+
RadioListTile<String>(
259+
title: const Text('TaskServer'),
260+
value: 'TW2',
261+
groupValue: selectedMode,
262+
onChanged: (String? value) {
263+
setState(() {
264+
selectedMode = value;
265+
});
266+
},
267+
),
268+
],
269+
);
270+
},
271+
),
245272
actions: <Widget>[
273+
// A button to cancel the operation
246274
TextButton(
247-
onPressed: currentMode != "TW3"
248-
? () {
249-
// Navigator.of(context).pop();
250-
Get.back();
251-
controller.profilesWidget.changeModeTo(
252-
profile,
253-
'TW3',
254-
);
255-
}
256-
: null,
257275
child: Text(
258-
"Taskchampion",
259-
style: TextStyle(
260-
color: tColors.primaryTextColor,
261-
),
276+
SentenceManager(
277+
currentLanguage: AppSettings.selectedLanguage)
278+
.sentences
279+
.cancel, // Assuming you have a 'cancel' string
280+
style: TextStyle(color: tColors.primaryTextColor),
262281
),
282+
onPressed: () {
283+
Get.back(); // Dismiss the dialog
284+
},
263285
),
286+
// A button to submit the change
264287
TextButton(
265-
onPressed: currentMode != "TW2"
266-
? () {
267-
// Navigator.of(context).pop();
268-
Get.back();
269-
controller.profilesWidget.changeModeTo(
270-
profile,
271-
'TW2',
272-
);
273-
}
274-
: null,
275288
child: Text(
276-
"TaskServer",
277-
style: TextStyle(
278-
color: tColors.primaryTextColor,
279-
),
289+
SentenceManager(
290+
currentLanguage: AppSettings.selectedLanguage)
291+
.sentences
292+
.submit, // Or use a translated string
293+
style: TextStyle(color: tColors.primaryTextColor),
280294
),
295+
onPressed: () {
296+
Get.back();
297+
if (selectedMode != null &&
298+
selectedMode != currentMode) {
299+
controller.profilesWidget.changeModeTo(
300+
profile,
301+
selectedMode!,
302+
);
303+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
304+
content: Text(
305+
SentenceManager(
306+
currentLanguage:
307+
AppSettings.selectedLanguage)
308+
.sentences
309+
.profilePageSuccessfullyChangedProfileModeTo +
310+
((selectedMode ?? "") == "TW3"
311+
? "CCSync"
312+
: "Taskserver"),
313+
style: TextStyle(
314+
color: tColors.primaryTextColor,
315+
),
316+
),
317+
backgroundColor:
318+
tColors.secondaryBackgroundColor,
319+
duration: const Duration(seconds: 2)));
320+
}
321+
},
281322
),
282323
],
283324
);

lib/app/modules/profile/views/profiles_list.dart

Lines changed: 74 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,57 @@ class ProfilesList extends StatelessWidget {
6060
child: const Icon(Icons.delete, color: Colors.white),
6161
),
6262
child: ExpansionTile(
63-
// Use ExpansionTile here
64-
title: Text(
65-
item,
66-
style: TextStyle(
67-
color: AppSettings.isDarkMode
68-
? TaskWarriorColors.kprimaryTextColor
69-
: TaskWarriorColors.kLightPrimaryTextColor,
70-
),
71-
),
72-
trailing: Row(
73-
mainAxisSize: MainAxisSize.min,
63+
// The title is now a Row to hold the text and the icon buttons
64+
title: Row(
7465
children: [
75-
IconButton(
76-
icon: Icon(Icons.edit,
77-
color: AppSettings.isDarkMode
78-
? TaskWarriorColors.kprimaryTextColor
79-
: TaskWarriorColors.kLightPrimaryTextColor),
80-
onPressed: () => rename(profileId),
66+
Expanded(
67+
child: Expanded(
68+
child: Column(
69+
crossAxisAlignment: CrossAxisAlignment
70+
.start, // Aligns text to the left
71+
children: [
72+
Text(
73+
item,
74+
style: TextStyle(
75+
decoration: profileId == currentProfile
76+
? TextDecoration.underline
77+
: TextDecoration.none,
78+
fontSize: 16.0, // Standard list tile title size
79+
color: AppSettings.isDarkMode
80+
? TaskWarriorColors.kprimaryTextColor
81+
: TaskWarriorColors.kLightPrimaryTextColor,
82+
),
83+
),
84+
const SizedBox(
85+
height:
86+
2.0), // Adds a small space between the texts
87+
Text(
88+
profileId,
89+
style: TextStyle(
90+
fontSize:
91+
10.0, // Smaller font size for the subtitle
92+
color: AppSettings.isDarkMode
93+
? Colors.grey[400]
94+
: Colors.grey[700],
95+
),
96+
),
97+
],
98+
),
99+
),
81100
),
82-
// The settings icon will now trigger the ExpansionTile's expansion/collapse
83-
// No need for a separate IconButton for settings if ExpansionTile handles it
84-
currentProfile != profileId
85-
? IconButton(
101+
// This Row holds the action buttons, keeping them separate from the tile's default trailing arrow
102+
Row(
103+
mainAxisSize: MainAxisSize.min,
104+
children: [
105+
IconButton(
106+
icon: Icon(Icons.edit,
107+
color: AppSettings.isDarkMode
108+
? TaskWarriorColors.kprimaryTextColor
109+
: TaskWarriorColors.kLightPrimaryTextColor),
110+
onPressed: () => rename(profileId),
111+
),
112+
if (currentProfile != profileId)
113+
IconButton(
86114
onPressed: () {
87115
selectProfile(profileId);
88116
},
@@ -91,18 +119,34 @@ class ProfilesList extends StatelessWidget {
91119
? TaskWarriorColors.kprimaryTextColor
92120
: TaskWarriorColors.kLightPrimaryTextColor),
93121
)
94-
: IconButton(
95-
onPressed: () {
96-
configure();
97-
},
98-
icon: Icon(Icons.key,
99-
color: AppSettings.isDarkMode
100-
? TaskWarriorColors.kprimaryTextColor
101-
: TaskWarriorColors.kLightPrimaryTextColor),
102-
),
122+
],
123+
),
103124
],
104125
),
126+
// By not specifying a 'trailing' widget, ExpansionTile uses its default arrow
105127
children: <Widget>[
128+
// The 'configure' option is now the first item inside the expandable list
129+
if (currentProfile == profileId)
130+
ListTile(
131+
leading: Icon(Icons.key,
132+
color: AppSettings.isDarkMode
133+
? TaskWarriorColors.kprimaryTextColor
134+
: TaskWarriorColors.kLightPrimaryTextColor),
135+
title: Text(
136+
SentenceManager(
137+
currentLanguage: AppSettings.selectedLanguage)
138+
.sentences
139+
.profilePageConfigureTaskserver, // New descriptive text
140+
style: TextStyle(
141+
color: AppSettings.isDarkMode
142+
? TaskWarriorColors.kprimaryTextColor
143+
: TaskWarriorColors.kLightPrimaryTextColor,
144+
),
145+
),
146+
onTap: () {
147+
configure();
148+
},
149+
),
106150
ListTile(
107151
leading: Icon(Icons.file_copy,
108152
color: AppSettings.isDarkMode

lib/app/utils/language/bengali_sentences.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,9 @@ class BengaliSentences extends Sentences {
229229
@override
230230
String get profilePageExportTasks => 'টাস্ক রপ্তানী করুন';
231231
@override
232-
String get profilePageChangeProfileMode =>
233-
'\u09aa\u09cd\u09b0\u09cb\u09ab\u09be\u0987\u09b2 \u09ae\u09c1\u09a1\u09cd\u09a7 \u09aa\u09b0\u09bf\u09ac\u09b0\u09cd\u09a4\u09bf \u0995\u09b0\u09be';
232+
String get profilePageChangeProfileMode => 'সিঙ্ক সার্ভার পরিবর্তন করুন';
234233
@override
235-
String get profilePageSelectProfileMode =>
236-
'\u09aa\u09cd\u09b0\u09cb\u09ab\u09be\u0981\u09b2 \u09ae\u09c1\u09a1\u09cd\u09a7 \u09a8\u09bf\u09b0\u09cd\u09ac\u09be\u099a\u09a8 \u0995\u09b0\u09c1\u09a8';
234+
String get profilePageSelectProfileMode => 'একটি সার্ভার নির্বাচন করুন';
237235
@override
238236
String get profilePageCopyConfigToNewProfile =>
239237
'নতুন প্রোফাইলে কনফিগারেশন কপি করুন';
@@ -252,6 +250,10 @@ class BengaliSentences extends Sentences {
252250
@override
253251
String get profilePageRenameAliasDialogueBoxSubmit => 'জমা দিন';
254252

253+
@override
254+
String get profilePageSuccessfullyChangedProfileModeTo =>
255+
'সফলভাবে প্রোফাইল মোড পরিবর্তিত হয়েছে: ';
256+
255257
@override
256258
String get profilePageExportTasksDialogueTitle => 'রপ্তানি ফরম্যাট';
257259
@override

lib/app/utils/language/english_sentences.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,12 @@ class EnglishSentences extends Sentences {
243243
@override
244244
String get profilePageExportTasks => 'Export Tasks';
245245
@override
246-
String get profilePageChangeProfileMode => 'Change Profile Mode';
246+
String get profilePageChangeProfileMode => 'Change Sync Server';
247247
@override
248-
String get profilePageSelectProfileMode => 'Select Profile Mode';
248+
String get profilePageSelectProfileMode => 'Select One Server';
249+
@override
250+
String get profilePageSuccessfullyChangedProfileModeTo =>
251+
'Successfully changed profile mode to';
249252
@override
250253
String get profilePageCopyConfigToNewProfile => 'Copy Config To New Profile';
251254
@override

lib/app/utils/language/french_sentences.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,10 @@ class FrenchSentences extends Sentences {
233233
@override
234234
String get profilePageExportTasks => 'Exporter les tâches';
235235
@override
236-
String get profilePageChangeProfileMode => 'Modifier le mode de profil';
236+
String get profilePageChangeProfileMode =>
237+
'Changer le serveur de synchronisation';
237238
@override
238-
String get profilePageSelectProfileMode => 'Sélectionner le mode de profil';
239+
String get profilePageSelectProfileMode => 'Sélectionnez un serveur';
239240
@override
240241
String get profilePageCopyConfigToNewProfile =>
241242
'Copier la configuration vers un nouveau profil';
@@ -249,6 +250,9 @@ class FrenchSentences extends Sentences {
249250
@override
250251
String get profilePageRenameAliasDialogueBoxNewAlias => 'Nouvel alias';
251252
@override
253+
String get profilePageSuccessfullyChangedProfileModeTo =>
254+
'Mode de profil changé avec succès en : ';
255+
@override
252256
String get profilePageRenameAliasDialogueBoxCancel => 'Annuler';
253257
@override
254258
String get profilePageRenameAliasDialogueBoxSubmit => 'Soumettre';

lib/app/utils/language/hindi_sentences.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ class HindiSentences extends Sentences {
246246
@override
247247
String get profilePageExportTasks => 'कार्य निर्यात करें';
248248
@override
249-
String get profilePageChangeProfileMode => 'प्रोफ़ाइल मोड बदलें';
249+
String get profilePageChangeProfileMode => 'सिंक सर्वर बदलें';
250250
@override
251-
String get profilePageSelectProfileMode => 'प्रोफ़ाइल मोड चुनें';
251+
String get profilePageSelectProfileMode => 'एक सर्वर चुनें';
252252
@override
253253
String get profilePageCopyConfigToNewProfile =>
254254
'नई प्रोफ़ाइल पर कॉन्फ़िगरेशन कॉपी करें';
@@ -262,6 +262,9 @@ class HindiSentences extends Sentences {
262262
@override
263263
String get profilePageRenameAliasDialogueBoxNewAlias => 'नया उपनाम';
264264
@override
265+
String get profilePageSuccessfullyChangedProfileModeTo =>
266+
'प्रोफ़ाइल मोड सफलतापूर्वक बदल दिया गया: ';
267+
@override
265268
String get profilePageRenameAliasDialogueBoxCancel => 'रद्द करें';
266269
@override
267270
String get profilePageRenameAliasDialogueBoxSubmit => 'प्रस्तुत करें';

lib/app/utils/language/marathi_sentences.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ class MarathiSentences extends Sentences {
230230
@override
231231
String get profilePageExportTasks => 'टास्क निर्यात करा';
232232
@override
233-
String get profilePageChangeProfileMode => 'प्रोफाइल मोड बदला';
233+
String get profilePageChangeProfileMode => 'सिंक सर्व्हर बदला';
234234
@override
235-
String get profilePageSelectProfileMode => 'प्रोफाइल मोड निवडा';
235+
String get profilePageSelectProfileMode => 'एक सर्व्हर निवडा';
236236
@override
237237
String get profilePageCopyConfigToNewProfile =>
238238
'नवीन प्रोफाइलवर कॉन्फिगरेशन कॉपी करा';
@@ -246,6 +246,9 @@ class MarathiSentences extends Sentences {
246246
@override
247247
String get profilePageRenameAliasDialogueBoxNewAlias => 'नवा उपनाम';
248248
@override
249+
String get profilePageSuccessfullyChangedProfileModeTo =>
250+
'प्रोफाइल मोड यशस्वीरीत्या बदलला: ';
251+
@override
249252
String get profilePageRenameAliasDialogueBoxCancel => 'रद्द करा';
250253
@override
251254
String get profilePageRenameAliasDialogueBoxSubmit => 'सादर करा';

lib/app/utils/language/sentences.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,5 @@ abstract class Sentences {
344344
// profile page new
345345
String get profilePageChangeProfileMode;
346346
String get profilePageSelectProfileMode;
347+
String get profilePageSuccessfullyChangedProfileModeTo;
347348
}

lib/app/utils/language/spanish_sentences.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ class SpanishSentences extends Sentences {
232232
@override
233233
String get profilePageExportTasks => 'Exportar tareas';
234234
@override
235-
String get profilePageChangeProfileMode => 'Cambiar modo de perfil';
235+
String get profilePageChangeProfileMode =>
236+
'Cambiar servidor de sincronización';
236237
@override
237-
String get profilePageSelectProfileMode => 'Seleccionar modo de perfil';
238+
String get profilePageSelectProfileMode => 'Selecciona un servidor';
238239
@override
239240
String get profilePageCopyConfigToNewProfile =>
240241
'Copiar configuración a un nuevo perfil';
@@ -250,6 +251,9 @@ class SpanishSentences extends Sentences {
250251
@override
251252
String get profilePageRenameAliasDialogueBoxCancel => 'Cancelar';
252253
@override
254+
String get profilePageSuccessfullyChangedProfileModeTo =>
255+
'Modo de perfil cambiado correctamente a: ';
256+
@override
253257
String get profilePageRenameAliasDialogueBoxSubmit => 'Enviar';
254258

255259
@override

0 commit comments

Comments
 (0)