Skip to content

Commit 5ffde7f

Browse files
committed
- upgrade app version
- add some packages - separate app file out main file - update deprecated code in app_button.dart - add restart dialog when user change language - remove scroll animation when enter chat with someone - make chat list start from last message like WhatsApp App - add link preview when send URL in chat and make it clickable - edit chat_bubbles package bubble_normal_image.dart file to show floating action button to save image if user is receiver - add download received images on Gallery feature when open it - add loading dialog until the image is sent or saved - add some extensions on String ( isContainsLink & isNullOrEmpty ) - add custom message bar widget - add custom link previewer widget - make some packages locally
1 parent a2772d4 commit 5ffde7f

Some content is hidden

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

73 files changed

+3482
-513
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ android {
4545
applicationId "com.chatchat.app"
4646
// You can update the following values to match your application needs.
4747
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
48-
minSdkVersion 21
48+
minSdkVersion 23
4949
targetSdkVersion flutter.targetSdkVersion
5050
versionCode flutterVersionCode.toInteger()
5151
versionName flutterVersionName

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<application
3+
android:requestLegacyExternalStorage="true"
34
android:label="Chat Chat"
45
android:name="${applicationName}"
56
android:icon="@mipmap/ic_launcher">

ios/Runner/Info.plist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77
<string>en</string>
88
<string>ar</string>
99
</array>
10+
<key>CFBundleURLTypes</key>
11+
<array>
12+
<dict>
13+
<key>CFBundleTypeRole</key>
14+
<string>Editor</string>
15+
<key>CFBundleURLName</key>
16+
<string>com.chatchat.app</string>
17+
<key>CFBundleURLSchemes</key>
18+
<array>
19+
<string>Chat Chat</string>
20+
</array>
21+
</dict>
22+
</array>
1023
<key>NSCameraUsageDescription</key>
1124
<string>Allow access to camera</string>
1225
<key>NSMicrophoneUsageDescription</key>

lib/chatchat.dart

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import 'package:easy_localization/easy_localization.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:flutter_native_splash/flutter_native_splash.dart';
4+
import 'package:flutter_screenutil/flutter_screenutil.dart';
5+
6+
import 'main.dart';
7+
import 'router/app_routes.dart';
8+
import 'themes/colors.dart';
9+
10+
class ChatChat extends StatefulWidget {
11+
final AppRoute appRoute;
12+
const ChatChat({
13+
super.key,
14+
required this.appRoute,
15+
});
16+
17+
@override
18+
State<ChatChat> createState() => _ChatChatState();
19+
}
20+
21+
class _ChatChatState extends State<ChatChat> {
22+
@override
23+
Widget build(BuildContext context) {
24+
return ScreenUtilInit(
25+
designSize: const Size(375, 812),
26+
minTextAdapt: true,
27+
splitScreenMode: true,
28+
child: MaterialApp(
29+
title: 'Chat Chat',
30+
localizationsDelegates: context.localizationDelegates,
31+
supportedLocales: context.supportedLocales,
32+
locale: context.locale,
33+
theme: ThemeData(
34+
useMaterial3: true,
35+
primaryColor: ColorsManager.greenPrimary,
36+
textSelectionTheme: const TextSelectionThemeData(
37+
cursorColor: ColorsManager.greenPrimary,
38+
selectionHandleColor: ColorsManager.greenPrimary,
39+
selectionColor: Color.fromARGB(209, 0, 168, 132),
40+
),
41+
progressIndicatorTheme: const ProgressIndicatorThemeData(
42+
color: ColorsManager.greenPrimary,
43+
),
44+
floatingActionButtonTheme: const FloatingActionButtonThemeData(
45+
backgroundColor: ColorsManager.greenPrimary,
46+
),
47+
scaffoldBackgroundColor: ColorsManager.backgroundDefaultColor,
48+
appBarTheme: const AppBarTheme(
49+
foregroundColor: Colors.white,
50+
backgroundColor: ColorsManager.appBarBackgroundColor,
51+
),
52+
),
53+
onGenerateRoute: widget.appRoute.onGenerateRoute,
54+
initialRoute: initialRoute,
55+
debugShowCheckedModeBanner: false,
56+
),
57+
);
58+
}
59+
60+
@override
61+
void initState() {
62+
super.initState();
63+
FlutterNativeSplash.remove();
64+
}
65+
}

lib/core/widgets/app_button.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ class AppButton extends StatelessWidget {
3131
return TextButton(
3232
onPressed: onPressed,
3333
style: ButtonStyle(
34-
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
34+
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
3535
RoundedRectangleBorder(
3636
borderRadius: BorderRadius.circular(
3737
borderRadius ?? 30,
3838
),
3939
),
4040
),
41-
backgroundColor: MaterialStatePropertyAll(
41+
backgroundColor: WidgetStatePropertyAll(
4242
backgroundColor ?? ColorsManager.greenPrimary,
4343
),
44-
padding: MaterialStateProperty.all<EdgeInsets>(
44+
padding: WidgetStateProperty.all<EdgeInsets>(
4545
EdgeInsets.symmetric(
4646
horizontal: horizontalPadding?.w ?? 12.w,
4747
vertical: verticalPadding?.h ?? 14.h,
4848
),
4949
),
50-
fixedSize: MaterialStateProperty.all(
50+
fixedSize: WidgetStateProperty.all(
5151
Size(buttonWidth?.w ?? double.maxFinite, buttonHeight?.h ?? 52.h),
5252
),
5353
),

lib/core/widgets/login_and_signup_form.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:awesome_dialog/awesome_dialog.dart';
2-
import '../../services/database.dart';
32
import 'package:cloud_firestore/cloud_firestore.dart';
43
import 'package:easy_localization/easy_localization.dart';
54
import 'package:firebase_auth/firebase_auth.dart';
@@ -13,6 +12,7 @@ import '../../../helpers/app_regex.dart';
1312
import '../../../themes/styles.dart';
1413
import '../../helpers/extensions.dart';
1514
import '../../router/routes.dart';
15+
import '../../services/database.dart';
1616
import 'app_button.dart';
1717
import 'app_text_form_field.dart';
1818
import 'password_validations.dart';

lib/core/widgets/modal_fit.dart

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1+
import 'package:awesome_dialog/awesome_dialog.dart';
12
import 'package:easy_localization/easy_localization.dart';
23
import 'package:flutter/material.dart';
34
import 'package:flutter_screenutil/flutter_screenutil.dart';
5+
import 'package:restart_app/restart_app.dart';
46

57
import '../../helpers/extensions.dart';
68
import '../../themes/colors.dart';
79
import '../../themes/styles.dart';
810

9-
class ModalFit extends StatelessWidget {
11+
class ModalFit extends StatefulWidget {
1012
const ModalFit({super.key});
1113

14+
@override
15+
State<ModalFit> createState() => _ModalFitState();
16+
}
17+
18+
class _ModalFitState extends State<ModalFit> {
1219
@override
1320
Widget build(BuildContext context) {
1421
return Material(
@@ -23,9 +30,24 @@ class ModalFit extends StatelessWidget {
2330
color: Colors.white,
2431
),
2532
tileColor: ColorsManager.appBarBackgroundColor,
26-
onTap: () {
27-
context.setLocale(const Locale("ar"));
28-
context.pop();
33+
onTap: () async {
34+
await AwesomeDialog(
35+
dismissOnBackKeyPress: true,
36+
dismissOnTouchOutside: true,
37+
context: context,
38+
dialogType: DialogType.info,
39+
animType: AnimType.scale,
40+
title: 'اعادة التشغيل مطلوبة',
41+
desc:
42+
'لتطبيق تغيير اللغة إلى العربية، يحتاج التطبيق إلى إعادة التشغيل. يرجى إعادة تشغيل التطبيق الآن.',
43+
btnCancelText: 'الغاء',
44+
btnCancelOnPress: () => context.pop(),
45+
btnOkText: 'إعادة التشغيل',
46+
btnOkOnPress: () async {
47+
await context.setLocale(const Locale("ar"));
48+
await Restart.restartApp();
49+
},
50+
).show();
2951
},
3052
),
3153
Container(
@@ -41,9 +63,24 @@ class ModalFit extends StatelessWidget {
4163
Icons.language_rounded,
4264
color: Colors.white,
4365
),
44-
onTap: () {
45-
context.setLocale(const Locale("en"));
46-
context.pop();
66+
onTap: () async {
67+
await AwesomeDialog(
68+
dismissOnBackKeyPress: true,
69+
dismissOnTouchOutside: true,
70+
context: context,
71+
dialogType: DialogType.info,
72+
animType: AnimType.scale,
73+
title: 'Restart Required',
74+
desc:
75+
'To apply the language change to English, the app needs to restart. Please restart the app now.',
76+
btnCancelText: 'Cancel',
77+
btnCancelOnPress: () => context.pop(),
78+
btnOkText: 'Restart',
79+
btnOkOnPress: () async {
80+
await context.setLocale(const Locale("en"));
81+
Restart.restartApp();
82+
},
83+
).show();
4784
},
4885
),
4986
],

0 commit comments

Comments
 (0)