mirror of
https://github.com/rainloreley/shlink-manager.git
synced 2024-11-24 18:43:02 +01:00
added core files with l10n
This commit is contained in:
parent
86dcba28e4
commit
9a2d3a7125
|
@ -0,0 +1,3 @@
|
||||||
|
arb-dir: lib/l10n
|
||||||
|
template-arb-file: app_en.arb
|
||||||
|
output-localization-file: app_localizations.dart
|
|
@ -0,0 +1,2 @@
|
||||||
|
{
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ import 'package:shlink_app/views/login_view.dart';
|
||||||
import 'package:shlink_app/views/navigationbar_view.dart';
|
import 'package:shlink_app/views/navigationbar_view.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
|
@ -40,6 +41,18 @@ class MyApp extends StatelessWidget {
|
||||||
_defaultDarkColorScheme,
|
_defaultDarkColorScheme,
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
),
|
),
|
||||||
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
|
localeListResolutionCallback: (locales, supportedLocales) {
|
||||||
|
for (Locale locale in locales!) {
|
||||||
|
if (supportedLocales.contains(locale) ||
|
||||||
|
supportedLocales.where((element) =>
|
||||||
|
element.languageCode == locale.languageCode).isNotEmpty) {
|
||||||
|
return locale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return const Locale('en');
|
||||||
|
},
|
||||||
home: const InitialPage());
|
home: const InitialPage());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:shlink_app/API/Classes/ShlinkStats/shlink_stats.dart';
|
||||||
import 'package:shlink_app/API/server_manager.dart';
|
import 'package:shlink_app/API/server_manager.dart';
|
||||||
import 'package:shlink_app/views/short_url_edit_view.dart';
|
import 'package:shlink_app/views/short_url_edit_view.dart';
|
||||||
import 'package:shlink_app/views/url_list_view.dart';
|
import 'package:shlink_app/views/url_list_view.dart';
|
||||||
|
import 'package:shlink_app/widgets/shlink_stats_card_widget.dart';
|
||||||
import '../API/Classes/ShortURL/short_url.dart';
|
import '../API/Classes/ShortURL/short_url.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals.dart' as globals;
|
||||||
|
|
||||||
|
@ -24,7 +25,6 @@ class _HomeViewState extends State<HomeView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
loadAllData();
|
loadAllData();
|
||||||
|
@ -113,22 +113,22 @@ class _HomeViewState extends State<HomeView> {
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
alignment: WrapAlignment.spaceEvenly,
|
alignment: WrapAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
_ShlinkStatsCardWidget(
|
ShlinkStatsCardWidget(
|
||||||
icon: Icons.link,
|
icon: Icons.link,
|
||||||
text:
|
text:
|
||||||
"${shlinkStats?.shortUrlsCount.toString() ?? "0"} Short URLs",
|
"${shlinkStats?.shortUrlsCount.toString() ?? "0"} Short URLs",
|
||||||
borderColor: Colors.blue),
|
borderColor: Colors.blue),
|
||||||
_ShlinkStatsCardWidget(
|
ShlinkStatsCardWidget(
|
||||||
icon: Icons.remove_red_eye,
|
icon: Icons.remove_red_eye,
|
||||||
text:
|
text:
|
||||||
"${shlinkStats?.nonOrphanVisits.total ?? "0"} Visits",
|
"${shlinkStats?.nonOrphanVisits.total ?? "0"} Visits",
|
||||||
borderColor: Colors.green),
|
borderColor: Colors.green),
|
||||||
_ShlinkStatsCardWidget(
|
ShlinkStatsCardWidget(
|
||||||
icon: Icons.warning,
|
icon: Icons.warning,
|
||||||
text:
|
text:
|
||||||
"${shlinkStats?.orphanVisits.total ?? "0"} Orphan Visits",
|
"${shlinkStats?.orphanVisits.total ?? "0"} Orphan Visits",
|
||||||
borderColor: Colors.red),
|
borderColor: Colors.red),
|
||||||
_ShlinkStatsCardWidget(
|
ShlinkStatsCardWidget(
|
||||||
icon: Icons.sell,
|
icon: Icons.sell,
|
||||||
text:
|
text:
|
||||||
"${shlinkStats?.tagsCount.toString() ?? "0"} Tags",
|
"${shlinkStats?.tagsCount.toString() ?? "0"} Tags",
|
||||||
|
@ -245,43 +245,3 @@ class _HomeViewState extends State<HomeView> {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// stats card widget
|
|
||||||
class _ShlinkStatsCardWidget extends StatefulWidget {
|
|
||||||
const _ShlinkStatsCardWidget(
|
|
||||||
{required this.text, required this.icon, this.borderColor});
|
|
||||||
|
|
||||||
final IconData icon;
|
|
||||||
final Color? borderColor;
|
|
||||||
final String text;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<_ShlinkStatsCardWidget> createState() => _ShlinkStatsCardWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ShlinkStatsCardWidgetState extends State<_ShlinkStatsCardWidget> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
var randomColor = ([...Colors.primaries]..shuffle()).first;
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: widget.borderColor ?? randomColor),
|
|
||||||
borderRadius: BorderRadius.circular(8)),
|
|
||||||
child: SizedBox(
|
|
||||||
child: Wrap(
|
|
||||||
children: [
|
|
||||||
Icon(widget.icon),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 4),
|
|
||||||
child: Text(widget.text,
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
// stats card widget
|
||||||
|
class ShlinkStatsCardWidget extends StatefulWidget {
|
||||||
|
const ShlinkStatsCardWidget(
|
||||||
|
{super.key, required this.text, required this.icon, this.borderColor});
|
||||||
|
|
||||||
|
final IconData icon;
|
||||||
|
final Color? borderColor;
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ShlinkStatsCardWidget> createState() => ShlinkStatsCardWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShlinkStatsCardWidgetState extends State<ShlinkStatsCardWidget> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var randomColor = ([...Colors.primaries]..shuffle()).first;
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: widget.borderColor ?? randomColor),
|
||||||
|
borderRadius: BorderRadius.circular(8)),
|
||||||
|
child: SizedBox(
|
||||||
|
child: Wrap(
|
||||||
|
children: [
|
||||||
|
Icon(widget.icon),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 4),
|
||||||
|
child: Text(widget.text,
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
14
pubspec.lock
14
pubspec.lock
|
@ -145,11 +145,10 @@ packages:
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
path: "."
|
name: flutter_launcher_icons
|
||||||
ref: "feat/monochrome-icons-support"
|
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
|
||||||
resolved-ref: "1902eba83da89b0350a70672ac7c963cd995e017"
|
url: "https://pub.dev"
|
||||||
url: "https://github.com/OutdatedGuy/flutter_launcher_icons.git"
|
source: hosted
|
||||||
source: git
|
|
||||||
version: "0.13.1"
|
version: "0.13.1"
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
|
@ -159,6 +158,11 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.1"
|
version: "3.0.1"
|
||||||
|
flutter_localizations:
|
||||||
|
dependency: "direct main"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_process_text:
|
flutter_process_text:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -37,11 +37,13 @@ dependencies:
|
||||||
dartz: ^0.10.1
|
dartz: ^0.10.1
|
||||||
qr_flutter: ^4.1.0
|
qr_flutter: ^4.1.0
|
||||||
tuple: ^2.0.2
|
tuple: ^2.0.2
|
||||||
intl: ^0.18.1
|
intl: any
|
||||||
dynamic_color: ^1.6.6
|
dynamic_color: ^1.6.6
|
||||||
url_launcher: 6.1.9
|
url_launcher: 6.1.9
|
||||||
package_info_plus: ^4.0.2
|
package_info_plus: ^4.0.2
|
||||||
shared_preferences: ^2.2.2
|
shared_preferences: ^2.2.2
|
||||||
|
flutter_localizations:
|
||||||
|
sdk: flutter
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
@ -53,6 +55,7 @@ dev_dependencies:
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
generate: true
|
||||||
|
|
||||||
# flutter pub run flutter_launcher_icons
|
# flutter pub run flutter_launcher_icons
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
|
|
|
@ -14,7 +14,6 @@ void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(const MyApp());
|
await tester.pumpWidget(const MyApp());
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
// Verify that our counter starts at 0.
|
||||||
expect(find.text('0'), findsOneWidget);
|
expect(find.text('0'), findsOneWidget);
|
||||||
expect(find.text('1'), findsNothing);
|
expect(find.text('1'), findsNothing);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user