Skip to content

Commit 93f7c86

Browse files
committed
Fix: button overflow in Select Directory
1 parent 6c07dd7 commit 93f7c86

File tree

1 file changed

+140
-122
lines changed

1 file changed

+140
-122
lines changed

lib/app/modules/settings/views/settings_page_select_directory_list_tile.dart

Lines changed: 140 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class SettingsPageSelectDirectoryListTile extends StatelessWidget {
2525

2626
@override
2727
Widget build(BuildContext context) {
28-
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
28+
TaskwarriorColorTheme tColors =
29+
Theme.of(context).extension<TaskwarriorColorTheme>()!;
2930
return ListTile(
3031
title: Text(
3132
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
@@ -51,148 +52,165 @@ class SettingsPageSelectDirectoryListTile extends StatelessWidget {
5152
const SizedBox(
5253
height: 10,
5354
),
54-
Row(
55-
children: [
56-
//Reset to default
57-
TextButton(
58-
style: ButtonStyle(
59-
backgroundColor: WidgetStateProperty.all<Color>(
60-
tColors.secondaryBackgroundColor!,
61-
),
62-
),
63-
onPressed: () async {
64-
if (await controller.getBaseDirectory() == "Default") {
65-
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
66-
content: Text(
67-
SentenceManager(
68-
currentLanguage: AppSettings.selectedLanguage)
69-
.sentences
70-
.settingsAlreadyDefault,
71-
style: TextStyle(
72-
color: tColors.primaryTextColor,
73-
),
74-
),
75-
backgroundColor: tColors.secondaryBackgroundColor,
76-
duration: const Duration(seconds: 2)));
77-
} else {
78-
showDialog(
79-
context: context,
80-
builder: (BuildContext context) {
81-
return Utils.showAlertDialog(
82-
title: Text(
83-
SentenceManager(
84-
currentLanguage:
85-
AppSettings.selectedLanguage)
86-
.sentences
87-
.settingsResetToDefault,
88-
style: GoogleFonts.poppins(
89-
fontWeight: FontWeight.bold,
90-
fontSize: TaskWarriorFonts.fontSizeMedium,
91-
color: tColors.primaryTextColor,
92-
),
93-
),
94-
content: Text(
95-
SentenceManager(
96-
currentLanguage:
97-
AppSettings.selectedLanguage)
98-
.sentences
99-
.settingsConfirmReset,
100-
style: GoogleFonts.poppins(
101-
color: TaskWarriorColors.grey,
102-
fontSize: TaskWarriorFonts.fontSizeMedium,
55+
IntrinsicHeight(
56+
child: Row(
57+
crossAxisAlignment: CrossAxisAlignment.stretch,
58+
children: [
59+
// Reset to Default Button
60+
Expanded(
61+
child: TextButton(
62+
style: ButtonStyle(
63+
backgroundColor: WidgetStateProperty.all<Color>(
64+
tColors.secondaryBackgroundColor!,
65+
),
66+
),
67+
onPressed: () async {
68+
if (await controller.getBaseDirectory() == "Default") {
69+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
70+
content: Text(
71+
SentenceManager(
72+
currentLanguage:
73+
AppSettings.selectedLanguage)
74+
.sentences
75+
.settingsAlreadyDefault,
76+
style: TextStyle(
77+
color: tColors.primaryTextColor,
78+
),
10379
),
104-
),
105-
actions: [
106-
TextButton(
107-
onPressed: () {
108-
Navigator.pop(context);
109-
},
110-
child: Text(
80+
backgroundColor: tColors.secondaryBackgroundColor,
81+
duration: const Duration(seconds: 2)));
82+
} else {
83+
showDialog(
84+
context: context,
85+
builder: (BuildContext context) {
86+
return Utils.showAlertDialog(
87+
title: Text(
11188
SentenceManager(
11289
currentLanguage:
11390
AppSettings.selectedLanguage)
11491
.sentences
115-
.settingsNoButton,
92+
.settingsResetToDefault,
11693
style: GoogleFonts.poppins(
94+
fontWeight: FontWeight.bold,
95+
fontSize: TaskWarriorFonts.fontSizeMedium,
11796
color: tColors.primaryTextColor,
11897
),
11998
),
120-
),
121-
TextButton(
122-
onPressed: () async {
123-
Navigator.pop(context);
124-
controller.isMovingDirectory.value = true;
125-
126-
// InheritedProfiles profilesWidget =
127-
// ProfilesWidget.of(context);
128-
var profilesWidget =
129-
Get.find<SplashController>();
130-
131-
Directory source =
132-
profilesWidget.baseDirectory();
133-
Directory destination =
134-
await profilesWidget.getDefaultDirectory();
135-
controller
136-
.moveDirectory(
137-
source.path, destination.path)
138-
.then((value) async {
139-
profilesWidget.setBaseDirectory(destination);
140-
SharedPreferences prefs =
141-
await SharedPreferences.getInstance();
142-
await prefs.remove('baseDirectory');
143-
controller.isMovingDirectory.value = false;
144-
controller.baseDirectory.value = "Default";
145-
});
146-
},
147-
child: Text(
99+
content: Text(
148100
SentenceManager(
149101
currentLanguage:
150102
AppSettings.selectedLanguage)
151103
.sentences
152-
.settingsYesButton,
104+
.settingsConfirmReset,
153105
style: GoogleFonts.poppins(
154-
color: tColors.primaryTextColor,
106+
color: TaskWarriorColors.grey,
107+
fontSize: TaskWarriorFonts.fontSizeMedium,
155108
),
156109
),
157-
),
158-
],
110+
actions: [
111+
TextButton(
112+
onPressed: () {
113+
Navigator.pop(context);
114+
},
115+
child: Text(
116+
SentenceManager(
117+
currentLanguage:
118+
AppSettings.selectedLanguage)
119+
.sentences
120+
.settingsNoButton,
121+
style: GoogleFonts.poppins(
122+
color: tColors.primaryTextColor,
123+
),
124+
),
125+
),
126+
TextButton(
127+
onPressed: () async {
128+
Navigator.pop(context);
129+
controller.isMovingDirectory.value = true;
130+
131+
// InheritedProfiles profilesWidget =
132+
// ProfilesWidget.of(context);
133+
var profilesWidget =
134+
Get.find<SplashController>();
135+
136+
Directory source =
137+
profilesWidget.baseDirectory();
138+
Directory destination = await profilesWidget
139+
.getDefaultDirectory();
140+
controller
141+
.moveDirectory(
142+
source.path, destination.path)
143+
.then((value) async {
144+
profilesWidget
145+
.setBaseDirectory(destination);
146+
SharedPreferences prefs =
147+
await SharedPreferences.getInstance();
148+
await prefs.remove('baseDirectory');
149+
controller.isMovingDirectory.value =
150+
false;
151+
controller.baseDirectory.value =
152+
"Default";
153+
});
154+
},
155+
child: Text(
156+
SentenceManager(
157+
currentLanguage:
158+
AppSettings.selectedLanguage)
159+
.sentences
160+
.settingsYesButton,
161+
style: GoogleFonts.poppins(
162+
color: tColors.primaryTextColor,
163+
),
164+
),
165+
),
166+
],
167+
);
168+
},
159169
);
160-
},
161-
);
162-
}
163-
},
164-
child: Text(
165-
SentenceManager(
166-
currentLanguage: controller.selectedLanguage.value)
167-
.sentences
168-
.settingsPageSetToDefault,
169-
style: TextStyle(
170-
color: tColors.purpleShade,
170+
}
171+
},
172+
child: Text(
173+
SentenceManager(
174+
currentLanguage:
175+
controller.selectedLanguage.value)
176+
.sentences
177+
.settingsPageSetToDefault,
178+
textAlign: TextAlign.center,
179+
softWrap: true,
180+
maxLines: 2,
181+
style: TextStyle(
182+
color: tColors.purpleShade,
183+
),
184+
),
171185
),
172186
),
173-
),
174-
const Spacer(),
175-
//Change directory
176-
TextButton(
177-
style: ButtonStyle(
178-
backgroundColor: WidgetStateProperty.all<Color>(
179-
tColors.secondaryBackgroundColor!,
180-
),
181-
),
182-
onPressed: () {
183-
controller.pickDirectory(context);
184-
},
185-
child: Text(
186-
SentenceManager(
187-
currentLanguage: controller.selectedLanguage.value)
188-
.sentences
189-
.settingsPageChangeDirectory,
190-
style: TextStyle(
191-
color: tColors.purpleShade,
187+
const SizedBox(width: 10),
188+
189+
// Change Directory Button
190+
Expanded(
191+
child: TextButton(
192+
style: ButtonStyle(
193+
backgroundColor: WidgetStateProperty.all<Color>(
194+
tColors.secondaryBackgroundColor!,
195+
),
196+
),
197+
onPressed: () => controller.pickDirectory(context),
198+
child: Text(
199+
SentenceManager(
200+
currentLanguage:
201+
controller.selectedLanguage.value)
202+
.sentences
203+
.settingsPageChangeDirectory,
204+
textAlign: TextAlign.center,
205+
softWrap: true,
206+
maxLines: 2,
207+
overflow: TextOverflow.visible,
208+
style: TextStyle(color: tColors.purpleShade),
209+
),
192210
),
193211
),
194-
),
195-
],
212+
],
213+
),
196214
),
197215
],
198216
),

0 commit comments

Comments
 (0)