Skip to content

Commit 43fae67

Browse files
committed
v 0.4.0
1 parent fbb6cb3 commit 43fae67

File tree

89 files changed

+380
-817
lines changed

Some content is hidden

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

89 files changed

+380
-817
lines changed

example/lib/controllers/home_controller.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class HomeController {
2626

2727
void startChat(String email) async {
2828
try {
29-
await VChatController.instance
30-
.createSingleChat(context: context, peerEmail: email);
29+
await VChatController.instance.createSingleChat(context: context, peerEmail: email);
3130
} on VChatSdkException catch (err) {
3231
CustomAlert.showError(context: context, err: err.toString());
3332
rethrow;

example/lib/controllers/login_controller.dart

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,18 @@ class LoginController {
2121
try {
2222
///Login on your system backend
2323
CustomAlert.customLoadingDialog(context: context);
24-
final d = (await CustomDio().send(
25-
reqMethod: "post",
26-
path: "user/login",
27-
body: {"email": email, "password": password}))
28-
.data['data'];
24+
final d =
25+
(await CustomDio().send(reqMethod: "post", path: "user/login", body: {"email": email, "password": password}))
26+
.data['data'];
2927
final u = User.fromMap(d);
3028

3129
await GetStorage().write("myModel", u.toMap());
3230

3331
///Login on v_chat_sdk system
34-
await VChatController.instance.login(
35-
context: context,
36-
dto: VChatLoginDto(email: email, password: password));
32+
await VChatController.instance.login(context: context, dto: VChatLoginDto(email: email, password: password));
3733
Navigator.pop(context);
38-
Navigator.of(context).pushAndRemoveUntil(
39-
MaterialPageRoute(builder: (context) => const Home()),
40-
(Route<dynamic> route) => false);
34+
Navigator.of(context)
35+
.pushAndRemoveUntil(MaterialPageRoute(builder: (context) => const Home()), (Route<dynamic> route) => false);
4136
} on VChatSdkException catch (err) {
4237
Navigator.pop(context);
4338
CustomAlert.showError(context: context, err: err.toString());

example/lib/controllers/register_controller.dart

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ class RegisterController {
3333
if (File(imagePath!).lengthSync() > 1024 * 1024 * 10) {
3434
throw "image size must be less than 10 Mb";
3535
}
36-
myUser = (await CustomDio().uploadFile(
37-
apiEndPoint: "user/register",
38-
filePath: imagePath!,
39-
body: [
40-
{"email": email},
41-
{"password": password},
42-
{"name": name},
43-
]))
36+
myUser = (await CustomDio().uploadFile(apiEndPoint: "user/register", filePath: imagePath!, body: [
37+
{"email": email},
38+
{"password": password},
39+
{"name": name},
40+
]))
4441
.data['data'];
4542
} else {
46-
myUser = (await CustomDio()
47-
.send(reqMethod: "post", path: "user/register", body: {
43+
myUser = (await CustomDio().send(reqMethod: "post", path: "user/register", body: {
4844
"email": email,
4945
"password": password,
5046
"name": name,
@@ -56,18 +52,16 @@ class RegisterController {
5652

5753
///Register on v_chat_sdk system
5854
await VChatController.instance.register(
59-
dto: VChatRegisterDto(
60-
name: name,
61-
userImage: imagePath == null ? null : File(imagePath!),
62-
email: email,
63-
password: password,
64-
),
65-
context: context
66-
);
55+
dto: VChatRegisterDto(
56+
name: name,
57+
userImage: imagePath == null ? null : File(imagePath!),
58+
email: email,
59+
password: password,
60+
),
61+
context: context);
6762
Navigator.pop(context);
68-
Navigator.of(context).pushAndRemoveUntil(
69-
MaterialPageRoute(builder: (context) => const Home()),
70-
(Route<dynamic> route) => false);
63+
Navigator.of(context)
64+
.pushAndRemoveUntil(MaterialPageRoute(builder: (context) => const Home()), (Route<dynamic> route) => false);
7165
} on VChatSdkException catch (err) {
7266
Navigator.pop(context);
7367
CustomAlert.showError(context: context, err: err.toString());

example/lib/generated/intl/messages_all.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
4141

4242
/// User programs should call this before using [localeName] for messages.
4343
Future<bool> initializeMessages(String localeName) async {
44-
var availableLocale = Intl.verifiedLocale(
45-
localeName, (locale) => _deferredLibraries[locale] != null,
46-
onFailure: (_) => null);
44+
var availableLocale =
45+
Intl.verifiedLocale(localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null);
4746
if (availableLocale == null) {
4847
return new Future.value(false);
4948
}
@@ -63,8 +62,7 @@ bool _messagesExistFor(String locale) {
6362
}
6463

6564
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
66-
var actualLocale =
67-
Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
65+
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
6866
if (actualLocale == null) return null;
6967
return _findExact(actualLocale);
7068
}

example/lib/generated/intl/messages_ar_EG.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class MessageLookup extends MessageLookupByLibrary {
2222

2323
final messages = _notInlinedMessages(_notInlinedMessages);
2424
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
25-
"allChatNotifications":
26-
MessageLookupByLibrary.simpleMessage("كل اشعارات المحادثه"),
25+
"allChatNotifications": MessageLookupByLibrary.simpleMessage("كل اشعارات المحادثه"),
2726
"ar": MessageLookupByLibrary.simpleMessage("عربي"),
2827
"changeLanguage": MessageLookupByLibrary.simpleMessage("تغيسر اللغه"),
2928
"changeTheme": MessageLookupByLibrary.simpleMessage("تغير الثيم"),
@@ -48,8 +47,7 @@ class MessageLookup extends MessageLookupByLibrary {
4847
"register": MessageLookupByLibrary.simpleMessage("تسجيل حساب"),
4948
"settings": MessageLookupByLibrary.simpleMessage("الاعدادات"),
5049
"test": MessageLookupByLibrary.simpleMessage("تست"),
51-
"thisDataFromMyServerNotVchat":
52-
MessageLookupByLibrary.simpleMessage("هذه الداتا من سيرفر خارجي"),
50+
"thisDataFromMyServerNotVchat": MessageLookupByLibrary.simpleMessage("هذه الداتا من سيرفر خارجي"),
5351
"update": MessageLookupByLibrary.simpleMessage("تحديث"),
5452
"updateProfile": MessageLookupByLibrary.simpleMessage("تحديث الحساب")
5553
};

example/lib/generated/intl/messages_en.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class MessageLookup extends MessageLookupByLibrary {
2222

2323
final messages = _notInlinedMessages(_notInlinedMessages);
2424
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
25-
"allChatNotifications":
26-
MessageLookupByLibrary.simpleMessage("All Chat notifications"),
25+
"allChatNotifications": MessageLookupByLibrary.simpleMessage("All Chat notifications"),
2726
"ar": MessageLookupByLibrary.simpleMessage("ar"),
28-
"changeLanguage":
29-
MessageLookupByLibrary.simpleMessage("Change language"),
27+
"changeLanguage": MessageLookupByLibrary.simpleMessage("Change language"),
3028
"changeTheme": MessageLookupByLibrary.simpleMessage("Change Theme"),
3129
"chats": MessageLookupByLibrary.simpleMessage("Chats"),
3230
"chooseImage": MessageLookupByLibrary.simpleMessage("choose image"),
@@ -49,8 +47,7 @@ class MessageLookup extends MessageLookupByLibrary {
4947
"register": MessageLookupByLibrary.simpleMessage("Register"),
5048
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
5149
"test": MessageLookupByLibrary.simpleMessage("test"),
52-
"thisDataFromMyServerNotVchat": MessageLookupByLibrary.simpleMessage(
53-
"This data from my server not vchat"),
50+
"thisDataFromMyServerNotVchat": MessageLookupByLibrary.simpleMessage("This data from my server not vchat"),
5451
"update": MessageLookupByLibrary.simpleMessage("Update"),
5552
"updateProfile": MessageLookupByLibrary.simpleMessage("Update profile")
5653
};

example/lib/generated/intl/messages_fr.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class MessageLookup extends MessageLookupByLibrary {
2222

2323
final messages = _notInlinedMessages(_notInlinedMessages);
2424
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
25-
"allChatNotifications":
26-
MessageLookupByLibrary.simpleMessage("All Chat notifications"),
25+
"allChatNotifications": MessageLookupByLibrary.simpleMessage("All Chat notifications"),
2726
"ar": MessageLookupByLibrary.simpleMessage("ar"),
28-
"changeLanguage":
29-
MessageLookupByLibrary.simpleMessage("Change language"),
27+
"changeLanguage": MessageLookupByLibrary.simpleMessage("Change language"),
3028
"changeTheme": MessageLookupByLibrary.simpleMessage("Change Theme"),
3129
"chats": MessageLookupByLibrary.simpleMessage("Chats"),
3230
"chooseImage": MessageLookupByLibrary.simpleMessage("choose image"),
@@ -48,8 +46,7 @@ class MessageLookup extends MessageLookupByLibrary {
4846
"password": MessageLookupByLibrary.simpleMessage("Password"),
4947
"register": MessageLookupByLibrary.simpleMessage("Register"),
5048
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
51-
"thisDataFromMyServerNotVchat": MessageLookupByLibrary.simpleMessage(
52-
"This data from my server not vchat"),
49+
"thisDataFromMyServerNotVchat": MessageLookupByLibrary.simpleMessage("This data from my server not vchat"),
5350
"update": MessageLookupByLibrary.simpleMessage("Update"),
5451
"updateProfile": MessageLookupByLibrary.simpleMessage("Update profile")
5552
};

example/lib/generated/l10n.dart

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/main.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import './screens/splash_screen.dart';
88
import 'controllers/language_controller.dart';
99
import 'generated/l10n.dart';
1010

11-
1211
class VChatCustomWidgets extends VChatWidgetBuilder {
1312
@override
1413
Color sendButtonColor(BuildContext context, bool isDark) {
@@ -35,8 +34,7 @@ void main() async {
3534

3635
// add support new language
3736
// v_chat will change the language one you change it
38-
VChatController.instance.setLocaleMessages(
39-
languageCode: "ar", countryCode: "EG", lookupMessages: ArLanguage());
37+
VChatController.instance.setLocaleMessages(languageCode: "ar", countryCode: "EG", lookupMessages: ArLanguage());
4038

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

example/lib/models/user.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ class User {
2727
accessToken == other.accessToken);
2828

2929
@override
30-
int get hashCode =>
31-
id.hashCode ^
32-
imageThumb.hashCode ^
33-
email.hashCode ^
34-
name.hashCode ^
35-
accessToken.hashCode;
30+
int get hashCode => id.hashCode ^ imageThumb.hashCode ^ email.hashCode ^ name.hashCode ^ accessToken.hashCode;
3631

3732
@override
3833
String toString() {

example/lib/screens/home.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ class _HomeState extends State<Home> {
3535

3636
if (GetStorage().hasData("myModel")) {
3737
// this mean my user has auth so i will bind chat controller to make him online else will throw exception
38-
VChatController.instance.bindChatControllers(
39-
context
40-
);
38+
VChatController.instance.bindChatControllers(context);
4139
}
4240
}
4341

@@ -53,7 +51,6 @@ class _HomeState extends State<Home> {
5351
actions: [
5452
IconButton(
5553
onPressed: () async {
56-
5754
final users = await _controller.getUsers();
5855
_usersList.clear();
5956
_usersList.addAll(users);
@@ -96,7 +93,6 @@ class _HomeState extends State<Home> {
9693
appBar: PreferredSize(
9794
child: _childrenAppBars[_currentIndex],
9895
preferredSize: const Size.fromHeight(kToolbarHeight),
99-
10096
),
10197
body: _children[_currentIndex], // new
10298
bottomNavigationBar: BottomNavigationBar(

example/lib/screens/login_screen.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@ class _LoginScreenState extends State<LoginScreen> {
4444
const SizedBox(
4545
height: 10,
4646
),
47-
TextButton(
48-
onPressed: _controller.login, child: S.of(context).login.text),
47+
TextButton(onPressed: _controller.login, child: S.of(context).login.text),
4948
const SizedBox(
5049
height: 10,
5150
),
52-
TextButton(
53-
onPressed: _controller.register,
54-
child: S.of(context).register.text),
51+
TextButton(onPressed: _controller.register, child: S.of(context).register.text),
5552
],
5653
),
5754
),

example/lib/screens/register_screen.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,10 @@ class _RegisterScreenState extends State<RegisterScreen> {
5656
InkWell(
5757
onTap: () async {
5858
final picker = ImagePicker();
59-
final img =
60-
await picker.pickImage(source: ImageSource.gallery);
59+
final img = await picker.pickImage(source: ImageSource.gallery);
6160
if (img != null) {
6261
_controller.imagePath = img.path;
63-
CustomAlert.showSuccess(
64-
context: context,
65-
err: "image has been set successfully");
62+
CustomAlert.showSuccess(context: context, err: "image has been set successfully");
6663
}
6764
},
6865
child: Row(
@@ -78,9 +75,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
7875
const SizedBox(
7976
height: 10,
8077
),
81-
TextButton(
82-
onPressed: _controller.register,
83-
child: S.of(context).register.text),
78+
TextButton(onPressed: _controller.register, child: S.of(context).register.text),
8479
],
8580
),
8681
),

example/lib/screens/setting_screen.dart

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class _SettingScreenState extends State<SettingScreen> {
2929
title: S.of(context).changeLanguage,
3030
icon: Icons.language,
3131
onTap: () async {
32-
final res = await CustomAlert.customChooseDialog(
33-
context: context,
34-
data: [S.of(context).ar, S.of(context).en]);
32+
final res =
33+
await CustomAlert.customChooseDialog(context: context, data: [S.of(context).ar, S.of(context).en]);
3534
if (res == 0) {
3635
Provider.of<LanguageController>(context, listen: false)
3736
.setLocale(const Locale.fromSubtags(languageCode: "ar"));
@@ -47,33 +46,28 @@ class _SettingScreenState extends State<SettingScreen> {
4746
icon: Icons.wb_sunny,
4847
onTap: () async {
4948
final res = await CustomAlert.customChooseDialog(
50-
context: context,
51-
data: [S.of(context).light, S.of(context).dark]);
49+
context: context, data: [S.of(context).light, S.of(context).dark]);
5250
if (res == 0) {
53-
Provider.of<LanguageController>(context, listen: false)
54-
.changeTheme(false);
51+
Provider.of<LanguageController>(context, listen: false).changeTheme(false);
5552
}
5653
if (res == 1) {
57-
Provider.of<LanguageController>(context, listen: false)
58-
.changeTheme(true);
54+
Provider.of<LanguageController>(context, listen: false).changeTheme(true);
5955
}
6056
},
6157
),
6258
ProfileItem(
6359
title: S.of(context).updateProfile,
6460
icon: Icons.edit,
6561
onTap: () {
66-
Navigator.of(context).push(MaterialPageRoute(
67-
builder: (_) => const UpdateUserProfileScreen()));
62+
Navigator.of(context).push(MaterialPageRoute(builder: (_) => const UpdateUserProfileScreen()));
6863
},
6964
),
7065
ProfileItem(
7166
title: S.of(context).allChatNotifications,
7267
icon: Icons.notification_important,
7368
onTap: () async {
74-
final res = await CustomAlert.customChooseDialog(
75-
context: context,
76-
data: [S.of(context).on, S.of(context).off]);
69+
final res =
70+
await CustomAlert.customChooseDialog(context: context, data: [S.of(context).on, S.of(context).off]);
7771
if (res == 0) {
7872
VChatController.instance.enableAllNotification();
7973
}
@@ -86,15 +80,12 @@ class _SettingScreenState extends State<SettingScreen> {
8680
title: S.of(context).logOut,
8781
icon: Icons.logout,
8882
onTap: () async {
89-
9083
await VChatController.instance.logOut();
9184

9285
await GetStorage().remove("myModel");
9386

9487
Navigator.of(context).pushAndRemoveUntil(
95-
MaterialPageRoute(
96-
builder: (context) => const SplashScreen()),
97-
(Route<dynamic> route) => false);
88+
MaterialPageRoute(builder: (context) => const SplashScreen()), (Route<dynamic> route) => false);
9889
},
9990
),
10091
],

0 commit comments

Comments
 (0)