From 0b489c519cca13a52ca444b5e568ef24a59ba61a Mon Sep 17 00:00:00 2001 From: Oleg Date: Sat, 10 Aug 2024 19:34:20 +0300 Subject: [PATCH] add licenses info to settings page --- .../settings/widget/settings_page.dart | 35 ++++++++++- .../settings/widget/settings_tile.dart | 60 +++++++++++++++++++ lib/l10n/app_en.arb | 4 +- lib/l10n/app_ru.arb | 4 +- 4 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 lib/feature/settings/widget/settings_tile.dart diff --git a/lib/feature/settings/widget/settings_page.dart b/lib/feature/settings/widget/settings_page.dart index 6d5b78a..b5cf501 100644 --- a/lib/feature/settings/widget/settings_page.dart +++ b/lib/feature/settings/widget/settings_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:uneconly/common/localization/localization.dart'; import 'package:uneconly/common/model/dependencies.dart'; import 'package:uneconly/common/utils/colors_utils.dart'; +import 'package:uneconly/feature/settings/widget/settings_tile.dart'; /// Flutter code sample for [CupertinoPicker]. @@ -186,9 +187,37 @@ class _SettingsPageState extends State { // }, // child: const Text('Open ListSectionInsetExample'), // ), - - Text('${AppLocalizations.of(context)!.theme}: '), - const SizedBox(height: 10), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + SettingsTile( + title: AppLocalizations.of(context)!.licenses, + description: AppLocalizations.of(context)!.showLicenses, + onPressed: () { + showLicensePage( + context: context, + ); + }, + ), + ], + ), + const SizedBox(height: 15), + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + ), + child: Text( + '${AppLocalizations.of(context)!.theme}: ', + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 18, + ), + ), + ), + ), + const SizedBox(height: 4), // horizontal list of themes Container( height: 40, diff --git a/lib/feature/settings/widget/settings_tile.dart b/lib/feature/settings/widget/settings_tile.dart new file mode 100644 index 0000000..aa9a1cd --- /dev/null +++ b/lib/feature/settings/widget/settings_tile.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; + +/// {@template settings_tile} +/// SettingsTile widget +/// {@endtemplate} +class SettingsTile extends StatelessWidget { + final String title; + final String description; + final VoidCallback onPressed; + + /// {@macro settings_tile} + const SettingsTile({ + super.key, + required this.title, + required this.description, + required this.onPressed, + }); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: double.infinity, + child: InkWell( + splashFactory: InkRipple.splashFactory, + onTap: onPressed, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + child: Ink( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 18, + ), + ), + const SizedBox( + height: 4, + ), + Text( + description, + style: const TextStyle( + fontWeight: FontWeight.w400, + fontSize: 14, + ), + ), + ], + ), + ), + ), + ), + ); + } +} // SettingsTile diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 00e98dc..390ee90 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -38,5 +38,7 @@ "favoriteGroups": "Favorite groups", "addFirstFavoriteGroup": "List is empty. Add groups to favorites to access it quickly", "add": "Add", - "noScheduleDescription": "Swipe left to see the schedule for the next week or right to see the schedule for the previous week" + "noScheduleDescription": "Swipe left to see the schedule for the next week or right to see the schedule for the previous week", + "licenses": "Licenses", + "showLicenses": "View licenses list" } \ No newline at end of file diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index ffe89a0..aea446d 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -35,5 +35,7 @@ "favoriteGroups": "Избранные группы", "addFirstFavoriteGroup": "Список пуст. Добавляйте группы в избранное, чтобы быстро получать к ним доступ", "add": "Добавить", - "noScheduleDescription": "Свайпните влево, чтобы посмотреть расписание на следующую неделю, или вправо, чтобы посмотреть на предыдущую" + "noScheduleDescription": "Свайпните влево, чтобы посмотреть расписание на следующую неделю, или вправо, чтобы посмотреть на предыдущую", + "licenses": "Лицензии", + "showLicenses": "Посмотреть список лицензий" } \ No newline at end of file