Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to Material 3 #380

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/pages/drawer/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class AboutPage extends StatelessWidget {
},
),
title: Text(AppLocalizations.of(context)!.aboutUs),
backgroundColor: Color(0xFFDC4654),
backgroundColor:
isDarkMode ? Color.fromRGBO(58, 21, 31, 1) : Color(0xFFDC4654),
),
body: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 20),
Expand Down
5 changes: 3 additions & 2 deletions lib/src/pages/drawer/legal.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
import '../pages_import.dart';


/// Page stating the legal Terms and Conditions and Privacy
/// Policy applying to the BLT project.
class LegalPage extends StatelessWidget {
const LegalPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Scaffold(
appBar: AppBar(
leading: IconButton(
Expand All @@ -20,7 +20,8 @@ class LegalPage extends StatelessWidget {
},
),
title: Text(AppLocalizations.of(context)!.termsOfService),
backgroundColor: Color(0xFFDC4654),
backgroundColor:
isDarkMode ? Color.fromRGBO(58, 21, 31, 1) : Color(0xFFDC4654),
),
body: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 20),
Expand Down
13 changes: 9 additions & 4 deletions lib/src/pages/drawer/referral.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:blt/src/pages/pages_import.dart';
import 'package:flutter/material.dart';


/// Page for allowing users to send referrals to their friends.
class ReferralPage extends StatefulWidget {
const ReferralPage({Key? key}) : super(key: key);
Expand All @@ -22,6 +21,7 @@ class _ReferralPageState extends State<ReferralPage> {
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;

return Scaffold(
appBar: AppBar(
Expand All @@ -34,7 +34,8 @@ class _ReferralPageState extends State<ReferralPage> {
},
),
title: Text(AppLocalizations.of(context)!.invite),
backgroundColor: Color(0xFFDC4654),
backgroundColor:
isDarkMode ? Color.fromRGBO(58, 21, 31, 1) : Color(0xFFDC4654),
),
body: SingleChildScrollView(
child: Container(
Expand Down Expand Up @@ -78,7 +79,9 @@ class _ReferralPageState extends State<ReferralPage> {
children: [
Icon(
Icons.group,
color: Color(0xFFDC4654),
color: isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
size: 250,
),
Container(
Expand Down Expand Up @@ -124,7 +127,9 @@ class _ReferralPageState extends State<ReferralPage> {
),
),
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
),
Expand Down
20 changes: 14 additions & 6 deletions lib/src/pages/drawer/social.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:blt/src/pages/pages_import.dart';
import 'package:flutter/material.dart';
//import 'package:flutter_inappwebview/flutter_inappwebview.dart';


class SocialPage extends ConsumerStatefulWidget {
const SocialPage({Key? key}) : super(key: key);

Expand All @@ -23,6 +22,7 @@ class _SocialPageState extends ConsumerState<SocialPage> {

@override
Widget build(BuildContext context) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Scaffold(
appBar: AppBar(
leading: IconButton(
Expand All @@ -34,7 +34,8 @@ class _SocialPageState extends ConsumerState<SocialPage> {
},
),
title: Text(AppLocalizations.of(context)!.social),
backgroundColor: Color(0xFFDC4654),
backgroundColor:
isDarkMode ? Color.fromRGBO(58, 21, 31, 1) : Color(0xFFDC4654),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
Expand All @@ -52,7 +53,8 @@ class _SocialPageState extends ConsumerState<SocialPage> {
style: GoogleFonts.aBeeZee(
textStyle: TextStyle(
fontSize: 20,
color: Color(0xFFDC4654),
color:
isDarkMode ? Colors.white : Color(0xFFDC4654),
),
fontWeight: FontWeight.bold,
),
Expand All @@ -70,7 +72,9 @@ class _SocialPageState extends ConsumerState<SocialPage> {
padding: EdgeInsets.only(
top: 10, bottom: 10, left: 20, right: 20),
decoration: BoxDecoration(
color: Color(0xFFDC4654),
color: isDarkMode
? Color.fromRGBO(82, 30, 44, 1)
: Color(0xFFDC4654),
borderRadius: BorderRadius.circular(10)),
width: MediaQuery.of(context).size.width * 0.85,
child: Row(
Expand Down Expand Up @@ -113,7 +117,9 @@ class _SocialPageState extends ConsumerState<SocialPage> {
padding: EdgeInsets.only(
top: 10, bottom: 10, left: 20, right: 20),
decoration: BoxDecoration(
color: Color(0xFFDC4654),
color: isDarkMode
? Color.fromRGBO(82, 30, 44, 1)
: Color(0xFFDC4654),
borderRadius: BorderRadius.circular(10)),
width: MediaQuery.of(context).size.width * 0.85,
child: Row(
Expand Down Expand Up @@ -152,7 +158,9 @@ class _SocialPageState extends ConsumerState<SocialPage> {
padding: EdgeInsets.only(
top: 10, bottom: 10, left: 20, right: 20),
decoration: BoxDecoration(
color: Color(0xFFDC4654),
color: isDarkMode
? Color.fromRGBO(82, 30, 44, 1)
: Color(0xFFDC4654),
borderRadius: BorderRadius.circular(10)),
width: MediaQuery.of(context).size.width * 0.85,
child: Row(
Expand Down
11 changes: 9 additions & 2 deletions lib/src/pages/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,17 @@ class _HomeState extends ConsumerState<Home> {
: Theme.of(context).canvasColor,
appBar: buildAppBar(context: context),
drawer: Drawer(
backgroundColor: isDarkMode.isDarkMode
? Color.fromRGBO(58, 21, 31, 1)
: Theme.of(context).canvasColor,
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
UserAccountsDrawerHeader(
decoration: BoxDecoration(
color: Color(0xFFDC4654),
color: isDarkMode.isDarkMode
? Color.fromRGBO(58, 21, 31, 1)
: Color(0xFFDC4654),
),
accountName: Text(
currentUser!.username!,
Expand Down Expand Up @@ -352,7 +357,9 @@ class _HomeState extends ConsumerState<Home> {
),
),
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode.isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
onPressed: () async {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/pages/home/issues.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class IssuesPageState extends ConsumerState<IssuesPage>
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
final issueState = ref.watch(issueListProvider);
final isDarkMode = ref.watch(darkModeProvider);
final isDarkMode = Theme.of(context).brightness == Brightness.dark;

return Scaffold(
backgroundColor: isDarkMode.isDarkMode
backgroundColor: isDarkMode
? Color.fromRGBO(34, 22, 23, 1)
: Theme.of(context).canvasColor,
body: RefreshIndicator(
Expand All @@ -69,7 +69,7 @@ class IssuesPageState extends ConsumerState<IssuesPage>
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
width: size.width,
color: isDarkMode.isDarkMode
color: isDarkMode
? Color.fromRGBO(34, 22, 23, 1)
: Theme.of(context).canvasColor,
child: Column(
Expand Down
21 changes: 16 additions & 5 deletions lib/src/pages/home/report_bug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ class _ReportFormState extends ConsumerState<ReportForm> {

@override
Widget build(BuildContext context) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Form(
key: _formKey,
child: Column(
Expand Down Expand Up @@ -409,7 +410,9 @@ class _ReportFormState extends ConsumerState<ReportForm> {
}
},
decoration: InputDecoration(
hintText: (_titleFocusNode.hasFocus) ? AppLocalizations.of(context)!.exampleURL : AppLocalizations.of(context)!.url,
hintText: (_titleFocusNode.hasFocus)
? AppLocalizations.of(context)!.exampleURL
: AppLocalizations.of(context)!.url,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(8.0),
Expand Down Expand Up @@ -468,7 +471,9 @@ class _ReportFormState extends ConsumerState<ReportForm> {
borderRadius: BorderRadius.all(
Radius.circular(8),
),
color: Color(0xFFDC4654),
color: isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
child: Center(
child: Builder(builder: (context) {
Expand Down Expand Up @@ -520,7 +525,9 @@ class _ReportFormState extends ConsumerState<ReportForm> {
backgroundColor: MaterialStateProperty.all(
duplicateVerified
? Color(0xFF50C878)
: Color(0xFFDC4654),
: isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
onPressed: () async {
Expand Down Expand Up @@ -724,7 +731,9 @@ class _ReportFormState extends ConsumerState<ReportForm> {
),
),
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
onPressed: () async {
Expand Down Expand Up @@ -896,7 +905,9 @@ class _ReportFormState extends ConsumerState<ReportForm> {
),
),
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
onPressed: () async {
Expand Down
17 changes: 13 additions & 4 deletions lib/src/pages/home/start_hunt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class _HuntFormState extends State<HuntForm> {

@override
Widget build(BuildContext context) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Form(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -145,7 +146,9 @@ class _HuntFormState extends State<HuntForm> {
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
),
Expand All @@ -169,7 +172,9 @@ class _HuntFormState extends State<HuntForm> {
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
),
Expand Down Expand Up @@ -199,7 +204,9 @@ class _HuntFormState extends State<HuntForm> {
decoration: BoxDecoration(
border: _image.path == ""
? Border.all(
color: Color(0xFFDC4654),
color: isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
width: 0.5,
)
: null,
Expand Down Expand Up @@ -280,7 +287,9 @@ class _HuntFormState extends State<HuntForm> {
),
),
backgroundColor: MaterialStateProperty.all(
Color(0xFFDC4654),
isDarkMode
? Color.fromRGBO(126, 33, 58, 1)
: Color(0xFFDC4654),
),
),
onPressed: () {},
Expand Down
6 changes: 4 additions & 2 deletions lib/src/util/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import 'package:flutter/material.dart';

class AppTheme {
static ThemeData lightTheme = ThemeData(
useMaterial3: true,
primarySwatch: Colors.red,
primaryColor: Colors.white,
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.light);

static ThemeData darkTheme =
ThemeData.dark().copyWith(brightness: Brightness.dark);
static ThemeData darkTheme = ThemeData.dark(
useMaterial3: true,
).copyWith(brightness: Brightness.dark);
}
Loading