Skip to content
This repository was archived by the owner on Feb 20, 2023. It is now read-only.

Dark theme mode added #193

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
15 changes: 14 additions & 1 deletion lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import 'package:afet_destek/pages/demands_page/demands_page.dart';
import 'package:afet_destek/pages/introduction_page/introduction_page.dart';
import 'package:afet_destek/shared/state/app_cubit.dart';
import 'package:afet_destek/shared/state/app_state.dart';
import 'package:afet_destek/shared/theme/state/theme_cubit.dart';
import 'package:afet_destek/shared/theme/state/theme_repository.dart';
import 'package:afet_destek/shared/theme/theme.dart';
import 'package:afet_destek/shared/widgets/loader.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:shared_preferences/shared_preferences.dart';

class DepremDestekApp extends StatefulWidget {
const DepremDestekApp({super.key});
Expand All @@ -36,6 +39,11 @@ class _DepremDestekAppState extends State<DepremDestekApp> {
RepositoryProvider<LocationRepository>(
create: (context) => LocationRepository(),
),
RepositoryProvider<ThemeRepository>(
create: (context) => ThemeRepository(
sharedPreferences: SharedPreferences.getInstance(),
),
),
],
child: MultiBlocProvider(
providers: [
Expand All @@ -45,13 +53,18 @@ class _DepremDestekAppState extends State<DepremDestekApp> {
locationRepository: context.read<LocationRepository>(),
),
),
BlocProvider<ThemeCubit>(
create: (context) => ThemeCubit(
themeRepository: context.read<ThemeRepository>()..getTheme(),
)..getCurrentTheme(),
),
],
child: BlocBuilder<AppCubit, AppState>(
builder: (context, state) {
return MaterialApp(
theme: AppTheme.light(context),
darkTheme: AppTheme.dark(context),
themeMode: ThemeMode.light,
themeMode: context.watch<ThemeCubit>().state.themeMode,
debugShowCheckedModeBanner: false,
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
Expand Down
8 changes: 6 additions & 2 deletions lib/pages/auth_page/auth_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ class _AuthPageState extends State<AuthPage> {
hintText: LocaleKeys.phone_number.getStr(),
isDense: false,
contentPadding: EdgeInsets.zero,
enabledBorder:
Theme.of(context).inputDecorationTheme.border,
),
style: Theme.of(context).textTheme.titleMedium,
inputFormatters: [
Expand Down Expand Up @@ -211,8 +213,8 @@ class _AuthPageState extends State<AuthPage> {
},
),
isDense: true,
suffixStyle:
TextStyle(color: context.appColors.black),
enabledBorder:
Theme.of(context).inputDecorationTheme.border,
),
onChanged: (code) => setState(() => _code = code),
),
Expand All @@ -230,6 +232,8 @@ class _AuthPageState extends State<AuthPage> {
ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: const Size(double.maxFinite - 40, 50),
disabledBackgroundColor:
context.appColors.disabledButton,
),
onPressed: (isButtonEnabled &&
_formKey.currentState != null &&
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/demand_details_page/demand_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class _DemandDetailsPageView extends StatelessWidget {
style: const TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24,
color: Color(0xff101828),
// color: Color(0xff101828),
),
)
],
Expand Down
7 changes: 6 additions & 1 deletion lib/pages/demand_details_page/widgets/copy_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ class CopyButton extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
const FittedBox(child: Icon(Icons.content_copy_rounded)),
Text(LocaleKeys.copy_button.getStr()),
Text(
LocaleKeys.copy_button.getStr(),
style: DefaultTextStyle.of(context)
.style
.copyWith(color: context.appColors.titles),
),
],
),
),
Expand Down
33 changes: 17 additions & 16 deletions lib/pages/demands_page/widgets/demand_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ class DemandCard extends StatelessWidget {
onTap: !isDetailed
? () => DemandDetailsPage.show(context, demand: demand)
: null,
child: DecoratedBox(
decoration: BoxDecoration(
color: context.appColors.white,
borderRadius: BorderRadius.circular(9),
),
child: Card(
child: Column(
children: [
Container(
Expand All @@ -66,10 +62,10 @@ class DemandCard extends StatelessWidget {
child: Text(
demand.addressText,
maxLines: 4,
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.w600,
fontSize: 20,
color: context.appColors.titles,
// color: context.appColors.titles,
),
),
),
Expand All @@ -93,14 +89,14 @@ class DemandCard extends StatelessWidget {
style: const TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xff475467),
// color: Color(0xff475467),
),
),
const SizedBox(width: 6),
const Text(
'•',
style: TextStyle(
color: Color(0xFFB0B5BC),
// color: Color(0xFFB0B5BC),
fontSize: 18,
),
),
Expand All @@ -110,22 +106,25 @@ class DemandCard extends StatelessWidget {
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Color(0xff475467),
// color: Color(0xff475467),
),
),
],
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 8),
child: Divider(color: Color(0xffE7EEF5), height: 1),
child: Divider(
color: Color(0xffE7EEF5),
height: 1,
),
),
Text(
LocaleKeys.needs.getStr(),
textAlign: TextAlign.left,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xff475467),
// color: Color(0xff475467),
),
),
const SizedBox(height: 8),
Expand Down Expand Up @@ -153,9 +152,9 @@ class DemandCard extends StatelessWidget {
LocaleKeys.details.getStr(),
style: const TextStyle(
fontWeight: FontWeight.w500,
color: Color(
0xff475467,
),
// color: Color(
// 0xff475467,
// ),
fontSize: 16,
),
),
Expand All @@ -164,7 +163,9 @@ class DemandCard extends StatelessWidget {
demand.notes,
maxLines: isDetailed ? 10000 : 5,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Color(0xff475467)),
// style: const TextStyle(
// // color: Color(0xff475467),
// ),
),
const SizedBox(height: 8),
if (!isDetailed) ...[
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/demands_page/widgets/demand_category_chip.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:afet_destek/shared/theme/color_extensions.dart';
import 'package:flutter/material.dart';

class DemandCategoryChip extends StatelessWidget {
Expand All @@ -18,10 +17,9 @@ class DemandCategoryChip extends StatelessWidget {
padding: const EdgeInsets.all(8),
child: Text(
label,
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14,
color: context.appColors.paragraph,
),
textAlign: TextAlign.center,
),
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/demands_page/widgets/demand_filter_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class _DemandFilterDrawerState extends State<DemandFilterDrawer> {
children: [
TextSpan(
text: LocaleKeys.distance.getStr(),
style: const TextStyle(color: Color(0xff475467)),
// style: const TextStyle(color: Color(0xff475467)),
),
TextSpan(
text: _filterRadiusKm == null
Expand Down Expand Up @@ -173,7 +173,7 @@ class _DemandFilterDrawerState extends State<DemandFilterDrawer> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
selectedColor: context.appColors.tags,
// selectedColor: context.appColors.tags,
selected: isSelected,
label: Text(category.name),
onSelected: (value) => setState(() {
Expand Down Expand Up @@ -247,7 +247,7 @@ class _DemandFilterDrawerState extends State<DemandFilterDrawer> {
fontSize: 16,
color: isFilterButton
? context.appColors.white
: context.appColors.notificationTermTexts,
: context.appColors.black,
),
),
);
Expand Down
14 changes: 11 additions & 3 deletions lib/pages/demands_page/widgets/demands_page_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:afet_destek/pages/demands_page/state/demands_cubit.dart';
import 'package:afet_destek/pages/my_demand_page/my_demand_page.dart';
import 'package:afet_destek/shared/extensions/translation_extension.dart';
import 'package:afet_destek/shared/theme/color_extensions.dart';
import 'package:afet_destek/shared/theme/state/theme_cubit.dart';
import 'package:afet_destek/shared/widgets/responsive_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -23,6 +24,15 @@ class DemandPageAppBar extends StatelessWidget implements PreferredSizeWidget {
hasMobileLeading: true,
mobileTile: Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 30),
child: IconButton(
onPressed: () {
context.read<ThemeCubit>().switchTheme();
},
icon: const Icon(Icons.light_mode),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: GestureDetector(
Expand Down Expand Up @@ -52,9 +62,7 @@ class DemandPageAppBar extends StatelessWidget implements PreferredSizeWidget {
isAuthorized
? LocaleKeys.my_support_demand.getStr()
: LocaleKeys.create_demand.getStr(),
style: TextStyle(
color: context.appColors.secondaryBackground,
),
style: TextStyle(color: context.appColors.white),
),
),
),
Expand Down
18 changes: 12 additions & 6 deletions lib/pages/kvkk_page/kvkk_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,21 @@ class _TermsPageState extends State<TermsPage> {
const SizedBox(
height: 16,
),
if (kIsWeb)
if (kIsWeb) ...[
Expanded(
child: htmlElementView(
viewType: 'browser_page',
onPlatformViewCreated: (data) {
_onFWWebViewCreated();
},
child: DecoratedBox(
decoration: const BoxDecoration(
color: Colors.white,
),
child: htmlElementView(
viewType: 'browser_page',
onPlatformViewCreated: (data) {
_onFWWebViewCreated();
},
),
),
)
]
],
),
),
Expand Down
Loading