Skip to content

Commit

Permalink
Merge pull request #365 from BrawlerXull/profile-page-multilang
Browse files Browse the repository at this point in the history
Profile page multilang
  • Loading branch information
Pavel401 authored Aug 27, 2024
2 parents 1c09780 + db7f89c commit b982dac
Show file tree
Hide file tree
Showing 11 changed files with 462 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:taskwarrior/app/utils/constants/taskwarrior_fonts.dart';
import 'package:taskwarrior/app/utils/constants/utilites.dart';

import 'package:taskwarrior/app/utils/gen/fonts.gen.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';
import 'package:taskwarrior/app/utils/theme/app_settings.dart';
import 'package:url_launcher/url_launcher.dart';

Expand All @@ -32,7 +33,9 @@ class ManageTaskServerPageAppBar extends StatelessWidget
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Configure TaskServer",
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskserver,
style: TextStyle(
fontFamily: FontFamily.poppins,
color: TaskWarriorColors.white,
Expand Down
157 changes: 109 additions & 48 deletions lib/app/modules/manageTaskServer/views/manage_task_server_page_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:taskwarrior/app/models/storage/set_config.dart';
import 'package:taskwarrior/app/modules/manageTaskServer/views/pem_widget.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_fonts.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';

import 'package:taskwarrior/app/utils/theme/app_settings.dart';

Expand All @@ -33,7 +34,9 @@ class ManageTaskServerPageBody extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Configure TASKRC",
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTASKRC,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand Down Expand Up @@ -76,7 +79,11 @@ class ManageTaskServerPageBody extends StatelessWidget {
MainAxisAlignment.start,
children: [
Text(
'Configure TaskRc',
SentenceManager(
currentLanguage: AppSettings
.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskRCDialogueBoxTitle,
style: TextStyle(
fontWeight: TaskWarriorFonts.bold,
color: AppSettings.isDarkMode
Expand All @@ -85,7 +92,11 @@ class ManageTaskServerPageBody extends StatelessWidget {
),
),
Text(
'Paste the taskrc content or select taskrc file',
SentenceManager(
currentLanguage: AppSettings
.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskRCDialogueBoxSubtitle,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand All @@ -107,44 +118,52 @@ class ManageTaskServerPageBody extends StatelessWidget {
.taskrcContentController,
maxLines: 8,
decoration: InputDecoration(
counterStyle: TextStyle(
color:
AppSettings.isDarkMode
? TaskWarriorColors
.white
: TaskWarriorColors
.black),
suffixIconConstraints:
const BoxConstraints(
maxHeight: 24,
maxWidth: 24,
),
isDense: true,
suffix: IconButton(
onPressed: () async {
controller
.setContent(context);
},
icon: const Icon(
Icons.content_paste),
),
border:
const OutlineInputBorder(),
labelStyle:
GoogleFonts.poppins(
color: AppSettings
.isDarkMode
? TaskWarriorColors
.white
: TaskWarriorColors
.black),
labelText:
'Paste your taskrc contents here'),
counterStyle: TextStyle(
color:
AppSettings.isDarkMode
? TaskWarriorColors
.white
: TaskWarriorColors
.black),
suffixIconConstraints:
const BoxConstraints(
maxHeight: 24,
maxWidth: 24,
),
isDense: true,
suffix: IconButton(
onPressed: () async {
controller
.setContent(context);
},
icon: const Icon(
Icons.content_paste),
),
border:
const OutlineInputBorder(),
labelStyle: GoogleFonts.poppins(
color:
AppSettings.isDarkMode
? TaskWarriorColors
.white
: TaskWarriorColors
.black),
labelText: SentenceManager(
currentLanguage:
AppSettings
.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskRCDialogueBoxInputFieldText,
),
),
),
),
Text(
"Or",
SentenceManager(
currentLanguage: AppSettings
.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskRCDialogueBoxOr,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand All @@ -170,7 +189,11 @@ class ManageTaskServerPageBody extends StatelessWidget {
Get.back();
},
child: Text(
'Select TASKRC file',
SentenceManager(
currentLanguage: AppSettings
.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskRCDialogueBoxSelectTaskRC,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand Down Expand Up @@ -203,8 +226,16 @@ class ManageTaskServerPageBody extends StatelessWidget {
children: [
Text(
controller.taskrcContentController.text.isEmpty
? "Set TaskRc"
: "Taskrc file is verified",
? SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageSetTaskRC
: SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageTaskRCFileIsVerified,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand Down Expand Up @@ -445,19 +476,49 @@ class ManageTaskServerPageBody extends StatelessWidget {
storage: controller.storage,
pem: pem,
optionString: pem == "taskd.certificate"
? "Configure your certificate"
? SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageConfigureYourCertificate
: pem == "taskd.key"
? "Configure TaskServer key"
? SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageConfigureTaskserverKey
: pem == "taskd.ca"
? "Configure Server Certificate"
: "Configure Server Certificate",
? SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageConfigureServerCertificate
: SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageConfigureServerCertificate,
listTileTitle: pem == "taskd.certificate"
? "Select Certificate"
? SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageSelectCertificate
: pem == "taskd.key"
? "Select key"
? SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageSelectKey
: pem == "taskd.ca"
? "Select Certificate"
: "Select Certificate",
? SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageSelectCertificate
: SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.manageTaskServerPageSelectCertificate,
onTapCallBack: controller.onTapPEMWidget,
onLongPressCallBack: controller.onLongPressPEMWidget,
),
Expand Down
6 changes: 5 additions & 1 deletion lib/app/modules/profile/views/deleteprofiledialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:get/get.dart';
import 'package:taskwarrior/app/modules/splash/controllers/splash_controller.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart';
import 'package:taskwarrior/app/utils/constants/utilites.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';
import 'package:taskwarrior/app/utils/theme/app_settings.dart';

class DeleteProfileDialog extends StatelessWidget {
Expand All @@ -23,7 +24,10 @@ class DeleteProfileDialog extends StatelessWidget {
child: Utils.showAlertDialog(
scrollable: true,
title: Text(
'Delete Profile?',
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageDeleteProfile,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand Down
45 changes: 39 additions & 6 deletions lib/app/modules/profile/views/manageprofile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_fonts.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';
import 'package:taskwarrior/app/utils/theme/app_settings.dart';

import 'package:tuple/tuple.dart';
Expand All @@ -25,11 +26,41 @@ class ManageProfile extends StatelessWidget {
@override
Widget build(BuildContext context) {
var triples = [
Tuple3(Icons.edit, 'Rename Alias', rename),
Tuple3(Icons.link, 'Configure Taskserver', configure),
Tuple3(Icons.upload, 'Export tasks', export),
Tuple3(Icons.copy, 'Copy config to new profile', copy),
Tuple3(Icons.delete, 'Delete profile', delete),
Tuple3(
Icons.edit,
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageRenameAlias,
rename,
),
Tuple3(
Icons.link,
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageConfigureTaskserver,
configure,
),
Tuple3(
Icons.upload,
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageExportTasks,
export,
),
Tuple3(
Icons.copy,
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageCopyConfigToNewProfile,
copy,
),
Tuple3(
Icons.delete,
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageDeleteProfile,
delete,
),
];

return ExpansionTile(
Expand All @@ -49,7 +80,9 @@ class ManageProfile extends StatelessWidget {
? TaskWarriorColors.white
: TaskWarriorColors.black,
title: Text(
'Manage selected profile',
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.profilePageManageSelectedProfile,
style: GoogleFonts.poppins(
fontWeight: TaskWarriorFonts.bold,
fontSize: TaskWarriorFonts.fontSizeMedium,
Expand Down
Loading

0 comments on commit b982dac

Please sign in to comment.