Skip to content

Commit ff22b01

Browse files
authored
Merge pull request #1 from safauludogan/version2
Version 2 finish
2 parents adb630e + 67c3181 commit ff22b01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+849
-158
lines changed

fonts/Montserrat-Black.ttf

193 KB
Binary file not shown.

fonts/Montserrat-Bold.ttf

193 KB
Binary file not shown.

fonts/Montserrat-Light.ttf

193 KB
Binary file not shown.

fonts/Montserrat-Medium.ttf

193 KB
Binary file not shown.

fonts/Montserrat-Regular.ttf

193 KB
Binary file not shown.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import 'package:flutter/foundation.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:flutter_architecture_template/core/init/cache/locale_manager.dart';
4+
import 'package:flutter_architecture_template/core/init/main/main_init.dart';
5+
import 'package:flutter_architecture_template/product/navigator/app_router.dart';
6+
import '../../features/authentication/login/model/login_response_model.dart';
7+
import '../constants/project_items.dart';
8+
import '../init/toast/toast_service.dart';
9+
10+
class AuthenticationManager with ToastService {
11+
AuthenticationManager._();
12+
static final AuthenticationManager _instance = AuthenticationManager._();
13+
14+
static AuthenticationManager get instance => _instance;
15+
16+
void logOut({bool force = false}) async {
17+
try {
18+
await LocaleManager.instance.clearAll();
19+
getIt<AppRouter>().replace(const SplashRoute());
20+
} catch (error) {
21+
if (kDebugMode) {
22+
debugPrint(
23+
'***** DEBUG MODE ***** -- AuthenticationManager -- \n${error.toString()}');
24+
}
25+
} finally {}
26+
}
27+
28+
void login(
29+
BuildContext context, LoginResponseModel loginResponseModel) async {
30+
try {
31+
await LocaleManager.instance.setStringValue(PreferencesKeys.token,
32+
value: loginResponseModel.token!);
33+
if (context.mounted) {
34+
showToast(label: ProjectItems.loginSuccess);
35+
}
36+
getIt<AppRouter>().replace(const HomeRoute());
37+
} catch (e) {
38+
if (kDebugMode) {
39+
debugPrint(
40+
'***** DEBUG MODE *****\nAuthenticationManager-login\n${e.toString()}');
41+
}
42+
}
43+
}
44+
45+
bool checkLoginStatus() {
46+
var token = LocaleManager.instance.getStringValue(PreferencesKeys.token);
47+
if (token != null) {
48+
return true;
49+
}
50+
return false;
51+
}
52+
53+
Future<void> updateToken(LoginResponseModel model) async {}
54+
}

lib/core/base/view/base_view.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/cupertino.dart';
2+
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
23
import 'package:mobx/mobx.dart';
34

45
class BaseView<T extends Store> extends StatefulWidget {
@@ -34,5 +35,6 @@ class _BaseViewState<T extends Store> extends State<BaseView<T>> {
3435
}
3536

3637
@override
37-
Widget build(BuildContext context) => widget.onPageBuilder(context, model);
38+
Widget build(BuildContext context) =>
39+
KeyboardDismisser(child: widget.onPageBuilder(context, model));
3840
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import 'package:flutter/cupertino.dart';
22
import 'package:flutter_architecture_template/core/init/cache/locale_manager.dart';
33
import 'package:flutter_architecture_template/product/manager/vexana_manager.dart';
4+
import 'package:vexana/vexana.dart';
45

56
abstract class BaseViewModel {
67
late BuildContext baseContext;
7-
VexanaManager? vexanaManager = VexanaManager.instance;
8-
VexanaManager get vexanaManagerComputed => VexanaManager.instance;
8+
INetworkManager vexanaManager = VexanaManager.instance.networkManager;
9+
INetworkManager get vexanaManagerComputed => vexanaManager;
910
LocaleManager localeManager = LocaleManager.instance;
11+
TickerProvider? tickerProvider;
1012

1113
void setContext(BuildContext context);
1214
void init();
13-
void disp();
15+
void disp() {}
1416
}

lib/core/components/view/no_network_widget.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_architecture_template/core/extension/context_extension.dart';
33
import 'package:flutter_architecture_template/core/init/utils/network/network_change_manager.dart';
4-
5-
import '../../constants/colors.dart';
64
import '../../constants/project_items.dart';
75
import '../network/viewmodel/no_network_viewmodel.dart';
86

@@ -14,23 +12,22 @@ class NoNetworkWidget extends StatefulWidget {
1412
}
1513

1614
class _NoNetworkWidgetState extends NoNetworkViewModel {
17-
1815
@override
1916
Widget build(BuildContext context) {
2017
return AnimatedCrossFade(
2118
firstChild: Column(
2219
children: [
23-
LinearProgressIndicator(
24-
backgroundColor: ColorConstants.redColor,
25-
color: ColorConstants.whiteColor,
20+
const LinearProgressIndicator(
21+
backgroundColor: Colors.red,
22+
color: Colors.white,
2623
),
2724
Center(
2825
child: Padding(
2926
padding: context.paddingLow,
3027
child: Text(
3128
ProjectItems.noInternetConnection,
32-
style: context.textTheme.bodyText1!
33-
.copyWith(color: ColorConstants.whiteColor),
29+
style: context.textTheme.labelMedium!
30+
.copyWith(color: Colors.white),
3431
),
3532
),
3633
),
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import 'package:flutter/foundation.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:flutter_architecture_template/core/extension/context_extension.dart';
4+
5+
class CustomElevatedButton extends StatelessWidget {
6+
CustomElevatedButton(
7+
{super.key, required this.text, required this.callback, this.isLoading});
8+
final String text;
9+
final VoidCallback callback;
10+
bool? isLoading = false;
11+
12+
@override
13+
Widget build(BuildContext context) {
14+
return ElevatedButton(
15+
onPressed: isLoading == true ? null : callback,
16+
child: SizedBox(
17+
height: kIsWeb == true
18+
? context.dynamicHeight(0.98)
19+
: context.dynamicHeight(0.065),
20+
child: Center(
21+
child: isLoading == true
22+
? const CircularProgressIndicator()
23+
: Text(
24+
text,
25+
style: context.textTheme.labelLarge!
26+
.copyWith(color: Colors.white),
27+
)),
28+
),
29+
);
30+
}
31+
}

0 commit comments

Comments
 (0)