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

Replace isDarkThemeEnabled with Theme.of(context).isDarkTheme #1004

Merged
merged 3 commits into from
Sep 18, 2023
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
4 changes: 2 additions & 2 deletions app/lib/account/register_account_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RegisterAccountSection extends StatelessWidget {
Text(
"Melde dich jetzt an und übertrage deine Daten! Die Anmeldung ist aus datenschutzrechtlichen Gründen erst ab 16 Jahren erlaubt.",
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey
: Colors.grey[600],
fontSize: 10),
Expand Down Expand Up @@ -218,7 +218,7 @@ class _SignUpButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final color =
isDarkThemeEnabled(context) ? Colors.grey[400] : Colors.grey[800];
Theme.of(context).isDarkTheme ? Colors.grey[400] : Colors.grey[800];
return InkWell(
borderRadius: _borderRadius,
onTap: onTap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UseAccountOnMultipleDevicesInstructions extends StatelessWidget {
body: DefaultTextStyle(
textAlign: TextAlign.center,
style: TextStyle(
color: isDarkThemeEnabled(context) ? Colors.white : Colors.black,
color: Theme.of(context).isDarkTheme ? Colors.white : Colors.black,
fontFamily: rubik,
),
child: SingleChildScrollView(
Expand Down
2 changes: 1 addition & 1 deletion app/lib/activation_code/activation_code_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _EnterActivationCodeAppBar extends StatelessWidget
),
centerTitle: true,
backgroundColor:
isDarkThemeEnabled(context) ? null : Theme.of(context).primaryColor,
Theme.of(context).isDarkTheme ? null : Theme.of(context).primaryColor,
iconTheme: const IconThemeData(color: Colors.white),
actions: const [],
bottom: const EnterActivationCodeTextField(),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/auth/email_and_password_link_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Future<void> handleEmailAndPasswordLinkSubmit(BuildContext context) async {
}

TextStyle _hintTextStyle(BuildContext context) => TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey
: Colors.grey[600]!.withOpacity(0.75),
fontSize: 11.5);
Expand Down Expand Up @@ -168,7 +168,7 @@ class BackIcon extends StatelessWidget {
left: 5,
child: SafeArea(
child: IconButton(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey
: darkBlueColor.withOpacity(0.4),
icon: Icon(themeIconData(Icons.arrow_back,
Expand Down
9 changes: 5 additions & 4 deletions app/lib/auth/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ class _ResetPasswordButton extends StatelessWidget {
child: Text(
'Passwort zurücksetzen',
style: TextStyle(
color: isDarkThemeEnabled(context) ? Colors.grey : Colors.black54,
color:
Theme.of(context).isDarkTheme ? Colors.grey : Colors.black54,
),
),
);
Expand Down Expand Up @@ -534,7 +535,7 @@ class _LoginWithQrCodeButton extends StatelessWidget {
"assets/icons/qr-code.svg",
width: 24,
height: 24,
color: isDarkThemeEnabled(context) ? Colors.white : Colors.black,
color: Theme.of(context).isDarkTheme ? Colors.white : Colors.black,
),
text: "Über einen Qr-Code einloggen",
onTap: () => Navigator.pushNamed(context, SignInWithQrCodePage.tag),
Expand All @@ -557,7 +558,7 @@ class _LoginWithAppleButton extends StatelessWidget {
"assets/logo/apple-logo.svg",
width: 24,
height: 24,
color: isDarkThemeEnabled(context) ? Colors.white : Colors.black,
color: Theme.of(context).isDarkTheme ? Colors.white : Colors.black,
),
onTap: onLogin,
text: 'Über Apple anmelden',
Expand Down Expand Up @@ -601,7 +602,7 @@ class _SignWithOAuthButton extends StatelessWidget {
child: Text(
text.toUpperCase(),
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.white
: Colors.grey[800],
fontWeight: FontWeight.w500,
Expand Down
3 changes: 2 additions & 1 deletion app/lib/blackboard/blackboard_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ class _TipIcon extends StatelessWidget {
child: Tooltip(
message: tooltip,
child: Icon(icon,
color: isDarkThemeEnabled(context) ? Colors.grey : Colors.grey[700],
color:
Theme.of(context).isDarkTheme ? Colors.grey : Colors.grey[700],
size: 20),
),
);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/blackboard/blackboard_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class __BlackboardDialogState extends State<_BlackboardDialog> {
? warnUserAboutLeavingForm(context)
: Future.value(true),
child: Scaffold(
backgroundColor: isDarkThemeEnabled(context) ? null : Colors.white,
backgroundColor: Theme.of(context).isDarkTheme ? null : Colors.white,
body: Column(
children: <Widget>[
_AppBar(
Expand Down Expand Up @@ -264,7 +264,7 @@ class _AppBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Theme.of(context).appBarTheme.backgroundColor
: Theme.of(context).primaryColor,
elevation: 1,
Expand Down
15 changes: 7 additions & 8 deletions app/lib/blackboard/details/blackboard_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,8 @@ class _Title extends StatelessWidget {
padding: const EdgeInsets.only(top: 8),
child: SelectableText(
title!,
style: Theme.of(context)
.textTheme
.headlineMedium!
.copyWith(color: isDarkThemeEnabled(context) ? null : Colors.black),
style: Theme.of(context).textTheme.headlineMedium!.copyWith(
color: Theme.of(context).isDarkTheme ? null : Colors.black),
),
);
}
Expand Down Expand Up @@ -394,8 +392,9 @@ class __UserReadTileState extends State<_UserReadTile> {
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
isDarkThemeEnabled(context) ? Colors.grey[400] : Colors.grey[300],
color: Theme.of(context).isDarkTheme
? Colors.grey[400]
: Colors.grey[300],
),
width: 30,
height: 30,
Expand Down Expand Up @@ -439,7 +438,7 @@ class _Text extends StatelessWidget {
theme.copyWith(
textTheme: theme.textTheme.copyWith(
bodyMedium: flowingText.copyWith(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.white
: Colors.black)),
),
Expand All @@ -449,7 +448,7 @@ class _Text extends StatelessWidget {
// // immer weiß ist. Ticket: https://github.com/flutter/flutter_markdown/issues/198

// p: flowingText.copyWith(
// color: isDarkThemeEnabled(context) ? Colors.white : Colors.black),
// color: Theme.of(context).isDarkTheme ? Colors.white : Colors.black),
// a: linkStyle(context, 15),
// ),
onTapLink: (url, _, __) => launchURL(url, context: context),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class _EventListFABSheet extends StatelessWidget {
const SizedBox(height: 20),
Text("Neu erstellen",
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey[100]
: Colors.grey[800],
fontSize: 18)),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class _DashboardPageState extends State<DashboardPage> {
appBarConfiguration: SliverAppBarConfiguration(
title: const _AppBarTitle(),
backgroundColor:
isDarkThemeEnabled(context) ? ElevationColors.dp8 : blueColor,
Theme.of(context).isDarkTheme ? ElevationColors.dp8 : blueColor,
expandedHeight: 210,
elevation: 1,
pinned: true,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/sections/dashboard_tip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _DashboardTipCard extends StatelessWidget {
child: AnnouncementCard(
key: ValueKey(dashboardTip),
padding: const EdgeInsets.all(0),
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.deepOrange[700]!
: Colors.amberAccent,
title: dashboardTip.title,
Expand Down
4 changes: 2 additions & 2 deletions app/lib/dashboard/timetable/lesson_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
part of '../dashboard_page.dart';

Color _getLessonCardTextColor(BuildContext context) =>
isDarkThemeEnabled(context) ? Colors.lightBlue : darkBlueColor;
Theme.of(context).isDarkTheme ? Colors.lightBlue : darkBlueColor;

class _LessonCard extends StatelessWidget {
const _LessonCard(this.view, {Key? key}) : super(key: key);
Expand Down Expand Up @@ -54,7 +54,7 @@ class _LessonCard extends StatelessWidget {
CircleAvatar(
radius: 17.5,
backgroundColor: isNow
? isDarkThemeEnabled(context)
? Theme.of(context).isDarkTheme
? Theme.of(context).cardColor
: Colors.white
: color.withOpacity(0.2),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/timetable/lesson_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class _EmptyStateMsg extends StatelessWidget {
text,
style: TextStyle(
fontSize: 18,
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.lightBlue
: darkBlueColor),
textAlign: TextAlign.center,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/widgets/blackboard_card_dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class _Title extends StatelessWidget {
return Text(
title,
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.lightBlue[100]
: darkBlueColor,
fontWeight: FontWeight.w500,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/widgets/dashboard_fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _DashboardFabSheet extends StatelessWidget {
const SizedBox(height: 20),
Text("Neu erstellen",
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey[100]
: Colors.grey[800],
fontSize: 18)),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/widgets/section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _Section extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(22, 18, 12, 6),
child: DefaultTextStyle(
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.lightBlue
: darkBlueColor,
fontSize: 18,
Expand Down
4 changes: 2 additions & 2 deletions app/lib/feedback/feedback_box_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ class _AnonymousCheckbox extends StatelessWidget {
child: Row(
children: <Widget>[
Icon(Icons.security,
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey
: Colors.grey[600]),
const SizedBox(width: 16),
Flexible(
child: Text(
"Ich möchte mein Feedback anonym abschicken",
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey[400]
: Colors.grey[600],
fontSize: 16),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/filesharing/widgets/file_sharing_page_fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class __FABModalBottomSheetContentState
const SizedBox(height: 20),
Text("Neu erstellen",
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey[100]
: Colors.grey[800],
fontSize: 18)),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/filesharing/widgets/filesharing_headline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FileSharingHeadline extends StatelessWidget {
child: Text(
title!,
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey[400]
: Colors.grey[700],
fontWeight: FontWeight.w600),
Expand Down
5 changes: 3 additions & 2 deletions app/lib/filesharing/widgets/sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ class FileSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
final TextStyle greyTextStyle = TextStyle(
color:
isDarkThemeEnabled(context) ? Colors.grey[400] : Colors.grey[600]);
color: Theme.of(context).isDarkTheme
? Colors.grey[400]
: Colors.grey[600]);
final api = BlocProvider.of<SharezoneContext>(context).api;
return SafeArea(
left: true,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/group_join/group_join_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GroupJoinAppBar extends StatelessWidget implements PreferredSizeWidget {
automaticallyImplyLeading: withBackIcon,
centerTitle: true,
backgroundColor:
isDarkThemeEnabled(context) ? null : Theme.of(context).primaryColor,
Theme.of(context).isDarkTheme ? null : Theme.of(context).primaryColor,
iconTheme: const IconThemeData(color: Colors.white),
actions: const [_SupportIcon()],
bottom: const GroupJoinTextField(),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/src/pages/course/course_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class CourseCardRedesign extends StatelessWidget {
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.lightBlue[100]
: darkBlueColor,
fontSize: 18,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _CourseEditPage extends StatelessWidget {
final courseNameNode = FocusNode();
return Scaffold(
appBar: AppBar(title: const Text("Kurs bearbeiten")),
backgroundColor: isDarkThemeEnabled(context) ? null : Colors.white,
backgroundColor: Theme.of(context).isDarkTheme ? null : Colors.white,
body: SingleChildScrollView(
padding: const EdgeInsets.all(8)
.add(const EdgeInsets.symmetric(horizontal: 4)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CourseTemplatePage extends StatelessWidget {
centerTitle: true,
actions: const [CourseTemplatePageFinishButton()],
),
backgroundColor: isDarkThemeEnabled(context) ? null : Colors.white,
backgroundColor: Theme.of(context).isDarkTheme ? null : Colors.white,
body: const SingleChildScrollView(
child: SafeArea(child: CourseTemplatePageBody()),
),
Expand Down Expand Up @@ -227,7 +227,7 @@ class CreateCustomCourseSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Theme.of(context).scaffoldBackgroundColor
: Colors.grey[100],
child: SafeArea(
Expand Down
4 changes: 2 additions & 2 deletions app/lib/groups/src/pages/course/group_help.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class _HowToJoinAGroupState extends State<_HowToJoinAGroup> {
if (value) {
setState(() {
// Expansion is open: so let's make the svg black
_svgColor = isDarkThemeEnabled(context)
_svgColor = Theme.of(context).isDarkTheme
? Colors.white
: Theme.of(context).colorScheme.secondary;
});
Expand Down Expand Up @@ -168,7 +168,7 @@ class _HowToJoinAGroupState extends State<_HowToJoinAGroup> {
if (value) {
setState(() {
// Expansion is open: so let's make the svg black
_typeInPublicKeyIconColor = isDarkThemeEnabled(context)
_typeInPublicKeyIconColor = Theme.of(context).isDarkTheme
? Colors.white
: Theme.of(context).colorScheme.secondary;
});
Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/src/pages/course/group_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class _JoinGroupTile extends StatelessWidget {
children: <Widget>[
const SizedBox(width: 16),
Icon(iconData,
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.white54
: Colors.grey[600]),
const SizedBox(width: 22),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/src/widgets/member_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class MemberTile extends StatelessWidget {
: withReportOption
? ReportIcon(
item: ReportItemReference.user(memberData.id.toString()),
color: isDarkThemeEnabled(context)
color: Theme.of(context).isDarkTheme
? Colors.grey
: Colors.grey[600],
)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/src/widgets/sharecode_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SharecodeText extends StatelessWidget {
@override
Widget build(BuildContext context) {
final style = TextStyle(
color: isDarkThemeEnabled(context) ? Colors.white : Colors.black,
color: Theme.of(context).isDarkTheme ? Colors.white : Colors.black,
fontSize: 22,
fontWeight: FontWeight.w500,
);
Expand Down
2 changes: 1 addition & 1 deletion app/lib/homework/shared/homework_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HomeworkTabBar extends StatelessWidget implements PreferredSizeWidget {
Color indicatorColor;
if (context != null) {
indicatorColor =
isDarkThemeEnabled(context) ? primaryColor : darkBlueColor;
Theme.of(context).isDarkTheme ? primaryColor : darkBlueColor;
} else {
// Ist egal, weil es ohne Kontext nur für preferredSize genutzt werden sollte
indicatorColor = primaryColor;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/homework/student/student_homework_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class StudentHomeworkPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bottomBarBackgroundColor =
isDarkThemeEnabled(context) ? Colors.grey[900] : Colors.grey[100];
Theme.of(context).isDarkTheme ? Colors.grey[900] : Colors.grey[100];
return ChangeNotifierProvider<BottomOfScrollViewInvisibilityController>(
create: (_) => BottomOfScrollViewInvisibilityController(),
child: WillPopScope(
Expand Down
Loading