refactor: use table in about

This commit is contained in:
Kingkor Roy Tirtho 2023-06-18 15:13:44 +06:00
parent 93bd4dc3aa
commit af6ab5fc2c
2 changed files with 65 additions and 63 deletions

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:spotube/collections/assets.gen.dart'; import 'package:spotube/collections/assets.gen.dart';
import 'package:spotube/components/shared/image/universal_image.dart'; import 'package:spotube/components/shared/image/universal_image.dart';
import 'package:spotube/components/shared/links/hyper_link.dart';
import 'package:spotube/components/shared/page_window_title_bar.dart'; import 'package:spotube/components/shared/page_window_title_bar.dart';
import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/context.dart';
import 'package:spotube/hooks/use_package_info.dart'; import 'package:spotube/hooks/use_package_info.dart';
@ -24,6 +25,8 @@ class AboutSpotube extends HookConsumerWidget {
final license = ref.watch(_licenseProvider); final license = ref.watch(_licenseProvider);
final theme = Theme.of(context); final theme = Theme.of(context);
final colon = Text(":");
return Scaffold( return Scaffold(
appBar: PageWindowTitleBar( appBar: PageWindowTitleBar(
leading: const BackButton(), leading: const BackButton(),
@ -40,77 +43,75 @@ class AboutSpotube extends HookConsumerWidget {
), ),
Center( Center(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
context.l10n.spotube_description, context.l10n.spotube_description,
style: theme.textTheme.titleLarge, style: theme.textTheme.titleLarge,
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Row( Table(
mainAxisSize: MainAxisSize.min, columnWidths: const {
0: FixedColumnWidth(95),
1: FixedColumnWidth(10),
2: IntrinsicColumnWidth(),
},
children: [ children: [
Text( TableRow(
"${context.l10n.founder}: ${context.l10n.kingkor_roy_tirtho}", children: [
style: const TextStyle( Text(context.l10n.founder),
fontWeight: FontWeight.bold, colon,
), Hyperlink(
context.l10n.kingkor_roy_tirtho,
"https://github.com/KRTirtho",
)
],
), ),
const SizedBox(width: 5), TableRow(
CircleAvatar( children: [
radius: 20, Text(context.l10n.version),
child: ClipOval( colon,
child: Image.network( Text("v${packageInfo.version}")
"https://avatars.githubusercontent.com/u/61944859?v=4", ],
),
TableRow(
children: [
Text(context.l10n.build_number),
colon,
Text(packageInfo.buildNumber.replaceAll(".", " "))
],
),
TableRow(
children: [
Text(context.l10n.repository),
colon,
const Hyperlink(
"github.com/KRTirtho/spotube",
"https://github.com/KRTirtho/spotube",
), ),
), ],
),
TableRow(
children: [
Text(context.l10n.license),
colon,
const Hyperlink(
"BSD-4-Clause",
"https://raw.githubusercontent.com/KRTirtho/spotube/master/LICENSE",
),
],
),
TableRow(
children: [
Text(context.l10n.bug_issues),
colon,
const Hyperlink(
"github.com/KRTirtho/spotube/issues",
"https://github.com/KRTirtho/spotube/issues",
),
],
), ),
], ],
), ),
const SizedBox(height: 5),
Text(
"${context.l10n.version}: v${packageInfo.version}",
),
const SizedBox(height: 5),
Text(
"${context.l10n.build_number}: ${packageInfo.buildNumber.replaceAll(".", " ")}",
),
const SizedBox(height: 5),
InkWell(
onTap: () {
launchUrlString(
"https://github.com/KRTirtho/spotube",
mode: LaunchMode.externalApplication,
);
},
child: Text(
"${context.l10n.repository}: https://github.com/KRTirtho/spotube",
),
),
const SizedBox(height: 5),
InkWell(
onTap: () {
launchUrlString(
"https://raw.githubusercontent.com/KRTirtho/spotube/master/LICENSE",
mode: LaunchMode.externalApplication,
);
},
child: Text(
"${context.l10n.license}: BSD-4-Clause",
),
),
const SizedBox(height: 5),
InkWell(
onTap: () {
launchUrlString(
"https://github.com/KRTirtho/spotube/issues",
mode: LaunchMode.externalApplication,
);
},
child: Text(
"${context.l10n.bug_issues}: https://github.com/KRTirtho/spotube/issues",
),
),
], ],
), ),
), ),

View File

@ -6,6 +6,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/spotube_icons.dart'; import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/shared/page_window_title_bar.dart'; import 'package:spotube/components/shared/page_window_title_bar.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/provider/blacklist_provider.dart'; import 'package:spotube/provider/blacklist_provider.dart';
class BlackListPage extends HookConsumerWidget { class BlackListPage extends HookConsumerWidget {
@ -38,7 +39,7 @@ class BlackListPage extends HookConsumerWidget {
return Scaffold( return Scaffold(
appBar: PageWindowTitleBar( appBar: PageWindowTitleBar(
title: const Text("Blacklist"), title: Text(context.l10n.blacklist),
centerTitle: true, centerTitle: true,
leading: const BackButton(), leading: const BackButton(),
), ),
@ -49,9 +50,9 @@ class BlackListPage extends HookConsumerWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextField( child: TextField(
onChanged: (value) => searchText.value = value, onChanged: (value) => searchText.value = value,
decoration: const InputDecoration( decoration: InputDecoration(
hintText: "Search", hintText: context.l10n.search,
prefixIcon: Icon(SpotubeIcons.search), prefixIcon: const Icon(SpotubeIcons.search),
), ),
), ),
), ),