Skip to content

Commit

Permalink
Full migrate to bloc state management
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemragab committed Nov 28, 2021
1 parent 6278a7d commit 92ff470
Show file tree
Hide file tree
Showing 91 changed files with 36 additions and 2,804 deletions.
12 changes: 6 additions & 6 deletions example/lib/controllers/login_controller.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';
Expand Down Expand Up @@ -32,12 +31,13 @@ class LoginController {
await GetStorage().write("myModel", u.toMap());

///Login on v_chat_sdk system
await VChatController.instance
.login(context: context,dto: VChatLoginDto(email: email, password: password));
await VChatController.instance.login(
context: context,
dto: VChatLoginDto(email: email, password: password));
Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const Home(),
));
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const Home()),
(Route<dynamic> route) => false);
} on VChatSdkException catch (err) {
Navigator.pop(context);
CustomAlert.showError(context: context, err: err.toString());
Expand Down
6 changes: 3 additions & 3 deletions example/lib/controllers/register_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class RegisterController {
context: context
);
Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const Home(),
));
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const Home()),
(Route<dynamic> route) => false);
} on VChatSdkException catch (err) {
Navigator.pop(context);
CustomAlert.showError(context: context, err: err.toString());
Expand Down
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import './screens/splash_screen.dart';
import 'controllers/language_controller.dart';
import 'generated/l10n.dart';

final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

class VChatCustomWidgets extends VChatWidgetBuilder {
@override
Expand Down Expand Up @@ -39,6 +38,8 @@ void main() async {
VChatController.instance.setLocaleMessages(
languageCode: "ar", countryCode: "EG", lookupMessages: ArLanguage());

// VChatController.instance.forceLanguage(languageCode: "ar",countryCode:'EG');

runApp(ChangeNotifierProvider<LanguageController>(
create: (context) => LanguageController(),
child: const MyApp(),
Expand All @@ -58,7 +59,6 @@ class _MyAppState extends State<MyApp> {
context.watch<LanguageController>();
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorKey: navigatorKey,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
localizationsDelegates: const [
Expand Down
2 changes: 1 addition & 1 deletion example/lib/screens/register_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: S.of(context).login.text,
title: S.of(context).register.text,
),
body: Padding(
padding: const EdgeInsets.all(8.0),
Expand Down
2 changes: 2 additions & 0 deletions example/lib/screens/splash_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';
import 'package:v_chat_sdk/v_chat_sdk.dart';

import 'home.dart';
import 'login_screen.dart';
Expand All @@ -18,6 +19,7 @@ class _SplashScreenState extends State<SplashScreen> {
void initState() {
super.initState();
startNavigate();

}

@override
Expand Down
46 changes: 0 additions & 46 deletions getx_translate_example/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions getx_translate_example/.metadata

This file was deleted.

16 changes: 0 additions & 16 deletions getx_translate_example/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions getx_translate_example/analysis_options.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions getx_translate_example/android/.gitignore

This file was deleted.

68 changes: 0 additions & 68 deletions getx_translate_example/android/app/build.gradle

This file was deleted.

This file was deleted.

41 changes: 0 additions & 41 deletions getx_translate_example/android/app/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

18 changes: 0 additions & 18 deletions getx_translate_example/android/app/src/main/res/values/styles.xml

This file was deleted.

This file was deleted.

Loading

0 comments on commit 92ff470

Please sign in to comment.