-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Testing localizations. - Initialize some screens.
- Loading branch information
1 parent
f1b0344
commit 3a9d217
Showing
24 changed files
with
600 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"appname": "DutSchedule", | ||
"featurenotready": "This function is in development. Check back soon", | ||
"mainview_tab_dashboard": "Dashboard", | ||
"mainview_tab_news": "News", | ||
"mainview_tab_account": "Accounts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"appname": "DutSchedule", | ||
"featurenotready": "Tính năng này đang được phát triển. Hãy kiểm tra lại sau.", | ||
"mainview_tab_dashboard": "Tổng quan", | ||
"mainview_tab_news": "Tin tức", | ||
"mainview_tab_account": "Tài khoản" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:dutwrapper/enums.dart'; | ||
|
||
class NewsSearchHistory { | ||
final String query; | ||
final NewsType newsType; | ||
final NewsSearchMethod searchMethod; | ||
|
||
const NewsSearchHistory({ | ||
required this.query, | ||
required this.newsType, | ||
required this.searchMethod, | ||
}); | ||
|
||
bool equals(NewsSearchHistory value) { | ||
return query == value.query && newsType == value.newsType && searchMethod == value.searchMethod; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../utils/theme_tools.dart'; | ||
|
||
class ListViewGroupItem extends StatelessWidget { | ||
const ListViewGroupItem({ | ||
super.key, | ||
this.padding = EdgeInsets.zero, | ||
required this.title, | ||
required this.children, | ||
this.dividerOnBottom = false, | ||
}); | ||
|
||
final EdgeInsets padding; | ||
final String title; | ||
final List<Widget> children; | ||
final bool dividerOnBottom; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: padding, | ||
width: double.infinity, | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: List.generate( | ||
children.length + 2, | ||
(index) { | ||
if (index == 0) { | ||
return Padding( | ||
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 5), | ||
child: Text( | ||
title, | ||
style: Theme.of(context).textTheme.labelLarge?.copyWith( | ||
color: Theme.of(context).colorScheme.primary, | ||
), | ||
), | ||
); | ||
} else if (index == children.length + 1) { | ||
return dividerOnBottom | ||
? Divider( | ||
color: ThemeTool.isAppDarkMode(context) ? Colors.white : Colors.black, | ||
thickness: 1, | ||
height: 0, | ||
) | ||
: Container(); | ||
} else { | ||
return children.elementAt(index - 1); | ||
} | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ListViewOptionItem extends StatelessWidget { | ||
const ListViewOptionItem({ | ||
super.key, | ||
required this.title, | ||
this.description, | ||
this.leading, | ||
this.trailing, | ||
this.onClick, | ||
}); | ||
|
||
final String title; | ||
final String? description; | ||
final Widget? leading; | ||
final Widget? trailing; | ||
final Function()? onClick; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
width: double.infinity, | ||
child: InkWell( | ||
onTap: () { | ||
onClick?.call(); | ||
}, | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 12, bottom: 15, left: 20, right: 20), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
leading != null ? leading! : Container(), | ||
Expanded( | ||
child: Padding( | ||
padding: EdgeInsets.only( | ||
left: leading != null ? 20 : 0, | ||
right: trailing != null ? 15 : 0, | ||
), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
title, | ||
style: Theme.of(context).textTheme.titleMedium, | ||
), | ||
description != null ? Text(description!) : Container(), | ||
], | ||
), | ||
), | ||
), | ||
trailing != null ? trailing! : Container(), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import '../../../utils/app_localizations.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../../../viewmodel/settings_instance.dart'; | ||
import '../../view_settings/settings_view.dart'; | ||
|
||
class DashboardTab extends StatelessWidget { | ||
const DashboardTab({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final settingsInstance = Provider.of<SettingsInstance>(context); | ||
|
||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text(AppLocalizations.of(context).translate("appname")), | ||
actions: [ | ||
IconButton( | ||
onPressed: () { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute(builder: (context) => SettingsView()), | ||
); | ||
}, | ||
icon: const Icon(Icons.settings), | ||
), | ||
], | ||
), | ||
body: Column( | ||
children: [ | ||
TextButton( | ||
onPressed: () { | ||
settingsInstance.setLocale(Locale("en", "US")); | ||
}, | ||
child: const Text("en-us"), | ||
), | ||
TextButton( | ||
onPressed: () { | ||
settingsInstance.setLocale(Locale("vi")); | ||
}, | ||
child: const Text("vi"), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.