Skip to content

Commit 2eca2c6

Browse files
committed
add app terms required by google
1 parent c6a42f8 commit 2eca2c6

22 files changed

+210
-39
lines changed

example/lib/app_terms.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:textless/textless.dart';
3+
4+
class AppTerms extends StatefulWidget {
5+
const AppTerms({Key? key}) : super(key: key);
6+
7+
@override
8+
_AppTermsState createState() => _AppTermsState();
9+
}
10+
11+
class _AppTermsState extends State<AppTerms> {
12+
@override
13+
Widget build(BuildContext context) {
14+
return Scaffold(
15+
appBar: AppBar(
16+
title: Text("Terms"),
17+
centerTitle: true,
18+
elevation: 0,
19+
),
20+
body: Column(
21+
children: [
22+
"* By entering and participating in the v chat 's you agree to the following terms and conditions of participation. "
23+
.text,
24+
"* These terms and conditions are contractually binding upon you and you agree to each of them. "
25+
.text,
26+
"* You enter and participate in the Chat Room and gain access to the materials contained thereon at your own risk."
27+
.text,
28+
"* We do not monitor or screen communications on the Chat Room and we are not responsible for any material that any Chat Room participant posts and we do not assume the responsibility to do so. "
29+
.text,
30+
"* We do not make any representations or warranties as to the truth or accuracy of any statement made or materials posted on or through the Chat Room. You agree and acknowledge that you assume the risk of any actions you take in reliance upon the information that may be contained in the Chat Room. "
31+
.text,
32+
"* We do not endorse or lend any credence for any statements that are made by any participant in the Chat Room. "
33+
.text,
34+
"* Any opinions or views expressed by Chat Room participants are their own. We do not endorse or support or otherwise give any credence or reason for reliance on any such statements or opinions. "
35+
.text,
36+
"* You are fully responsible for your own statements and materials that you post in the Chat Room and any consequences, whether or not foreseen, to any party who may rely upon these statements. "
37+
.text,
38+
],
39+
),
40+
);
41+
}
42+
}

example/lib/controllers/login_controller.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class LoginController {
99
BuildContext context;
1010
final emailTxtController = TextEditingController();
1111
final passwordTxtController = TextEditingController();
12+
bool appTerms = false;
1213

1314
LoginController(this.context);
1415

@@ -17,6 +18,9 @@ class LoginController {
1718
//final password = passwordTxtController.text.toString();
1819
try {
1920
CustomAlert.customLoadingDialog(context: context);
21+
if (!appTerms) {
22+
throw "accept v chat terms to use the app";
23+
}
2024

2125
///First Login on your system backend
2226
///Once success login then start login to v chat sdk

example/lib/controllers/register_controller.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class RegisterController {
1010
final emailTxtController = TextEditingController();
1111
final nameTxtController = TextEditingController();
1212
final passwordTxtController = TextEditingController();
13-
13+
bool appTerms = false;
1414
String? imagePath;
1515

1616
RegisterController(this.context);
@@ -22,6 +22,9 @@ class RegisterController {
2222

2323
try {
2424
CustomAlert.customLoadingDialog(context: context);
25+
if (!appTerms) {
26+
throw "accept v chat terms to use the app";
27+
}
2528

2629
/// your image validation
2730
if (imagePath != null) {

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void main() async {
2727
enableLogger: true,
2828
maxMediaUploadSize: 50 * 1000 * 1000,
2929
passwordHashKey: "passwordHashKey",
30-
maxGroupChatUsers: 500,
30+
maxGroupChatUsers: 512,
3131
);
3232

3333
/// add support new language

example/lib/screens/login_screen.dart

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:example/app_terms.dart';
12
import 'package:example/generated/l10n.dart';
23
import 'package:flutter/material.dart';
34
import 'package:textless/textless.dart';
@@ -59,15 +60,40 @@ class _LoginScreenState extends State<LoginScreen> {
5960
const SizedBox(
6061
height: 10,
6162
),
63+
Row(
64+
children: [
65+
Checkbox(
66+
value: _controller.appTerms,
67+
onChanged: (v) {
68+
setState(() {
69+
_controller.appTerms = v!;
70+
});
71+
}),
72+
const SizedBox(
73+
width: 10,
74+
),
75+
InkWell(
76+
onTap: () {
77+
Navigator.of(context).push(
78+
MaterialPageRoute(builder: (_) => AppTerms()));
79+
},
80+
child: "accept V Chat terms".text.color(Colors.blue))
81+
],
82+
),
83+
const SizedBox(
84+
height: 10,
85+
),
6286
ElevatedButton(
63-
onPressed: _controller.login,
64-
child: S.of(context).login.text),
87+
onPressed: _controller.login,
88+
child: S.of(context).login.text,
89+
),
6590
const SizedBox(
6691
height: 10,
6792
),
6893
TextButton(
69-
onPressed: _controller.register,
70-
child: S.of(context).register.text),
94+
onPressed: _controller.register,
95+
child: S.of(context).register.text,
96+
),
7197
],
7298
),
7399
),

example/lib/screens/register_screen.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:example/utils/custom_alert.dart';
55
import 'package:flutter/material.dart';
66
import 'package:image_picker/image_picker.dart';
77
import 'package:textless/textless.dart';
8+
import '../app_terms.dart';
89
import '../controllers/register_controller.dart';
910

1011
class RegisterScreen extends StatefulWidget {
@@ -72,6 +73,29 @@ class _RegisterScreenState extends State<RegisterScreen> {
7273
const SizedBox(
7374
height: 20,
7475
),
76+
Row(
77+
children: [
78+
Checkbox(
79+
value: _controller.appTerms,
80+
onChanged: (v) {
81+
setState(() {
82+
_controller.appTerms = v!;
83+
});
84+
}),
85+
const SizedBox(
86+
width: 10,
87+
),
88+
InkWell(
89+
onTap: () {
90+
Navigator.of(context).push(
91+
MaterialPageRoute(builder: (_) => AppTerms()));
92+
},
93+
child: "accept V Chat terms".text.color(Colors.blue))
94+
],
95+
),
96+
const SizedBox(
97+
height: 10,
98+
),
7599
InkWell(
76100
onTap: () async {
77101
final picker = ImagePicker();

example/lib/screens/setting_screen.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,20 @@ class _SettingScreenState extends State<SettingScreen> {
3939
await GetStorage().write("lng", "ar");
4040
Provider.of<AppController>(context, listen: false)
4141
.setLocale(const Locale.fromSubtags(languageCode: "ar"));
42+
await VChatController.instance.changeLanguage("ar");
4243
}
4344
if (res == 1) {
4445
await GetStorage().write("lng", "en");
4546
Provider.of<AppController>(context, listen: false)
4647
.setLocale(const Locale.fromSubtags(languageCode: "en"));
48+
await VChatController.instance.changeLanguage("en");
4749
}
4850
if (res == 2) {
4951
await GetStorage().write("lng", "pt_BR");
5052
Provider.of<AppController>(context, listen: false).setLocale(
5153
const Locale.fromSubtags(
5254
languageCode: "pt", countryCode: "BR"));
55+
await VChatController.instance.changeLanguage("pt_BR");
5356
}
5457
},
5558
),

example/pubspec.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ packages:
886886
path: ".."
887887
relative: true
888888
source: path
889-
version: "1.0.0"
889+
version: "1.0.1"
890890
vector_math:
891891
dependency: transitive
892892
description:
@@ -900,7 +900,7 @@ packages:
900900
name: video_player
901901
url: "https://pub.dartlang.org"
902902
source: hosted
903-
version: "2.2.7"
903+
version: "2.2.8"
904904
video_player_platform_interface:
905905
dependency: transitive
906906
description:
@@ -1000,5 +1000,5 @@ packages:
10001000
source: hosted
10011001
version: "3.1.0"
10021002
sdks:
1003-
dart: ">=2.15.0 <3.0.0"
1003+
dart: ">=2.14.0 <3.0.0"
10041004
flutter: ">=2.5.0"

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1515
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18-
version: 1.1.2+8
18+
version: 1.1.3+9
1919

2020
environment:
2121
sdk: ">=2.12.0 <3.0.0"

lib/src/modules/image_viewer/views/image_viewer_view.dart

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
11
import 'package:flutter/material.dart';
22
import 'package:photo_view/photo_view.dart';
3+
import 'package:v_chat_sdk/src/modules/rooms/cubit/room_cubit.dart';
34

4-
class ImageViewerView extends StatelessWidget {
5+
class ImageViewerView extends StatefulWidget {
56
final String url;
67

78
const ImageViewerView(this.url, {Key? key}) : super(key: key);
89

10+
@override
11+
State<ImageViewerView> createState() => _ImageViewerViewState();
12+
}
13+
14+
class _ImageViewerViewState extends State<ImageViewerView> {
15+
@override
16+
void initState() {
17+
super.initState();
18+
RoomCubit.instance.isOpenMessageImageOrVideo = true;
19+
}
20+
21+
@override
22+
void dispose() {
23+
RoomCubit.instance.isOpenMessageImageOrVideo = false;
24+
super.dispose();
25+
}
26+
927
@override
1028
Widget build(BuildContext context) {
29+
FocusScope.of(context).unfocus();
1130
final isRtl = Directionality.of(context).index == 0;
1231
FocusScope.of(context).unfocus();
1332
return SafeArea(
1433
child: Stack(
1534
fit: StackFit.expand,
1635
children: [
1736
PhotoView(
18-
imageProvider: NetworkImage(url),
37+
imageProvider: NetworkImage(widget.url),
1938
),
2039
if (isRtl)
2140
Positioned(

lib/src/modules/message/cubit/message_cubit.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ class MessageCubit extends Cubit<MessageState> with WidgetsBindingObserver {
297297
if (isEmitTyping) {
298298
emitTypingChange(0);
299299
}
300-
// Helpers.vlog("close for cubit called room Id $roomId ${DateTime.now()}");
301300
super.close();
302301
}
303302

lib/src/modules/message/views/list_view_widgets/message_image_item.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class MessageImageItem extends StatelessWidget {
3838
constraints: const BoxConstraints(maxHeight: 500),
3939
height: double.parse(_message.messageAttachment!.height!),
4040
width: double.parse(_message.messageAttachment!.width!),
41-
color: Colors.grey[300],
41+
color: Theme.of(context).brightness == Brightness.dark
42+
? Colors.black26
43+
: Colors.grey[300],
4244
child: CachedNetworkImage(
4345
imageUrl: VChatConfig.messagesMediaBaseUrl +
4446
_message.messageAttachment!.imageUrl.toString(),

lib/src/modules/message/views/list_view_widgets/message_video_item.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class MessageVideoItem extends StatelessWidget {
3434
width: double.parse(att.width!),
3535
decoration: BoxDecoration(
3636
borderRadius: BorderRadius.circular(15),
37-
color: Colors.grey,
37+
color: Theme.of(context).brightness == Brightness.dark
38+
? Colors.black26
39+
: Colors.grey[300],
3840
),
3941
child: Stack(
4042
alignment: Alignment.center,

lib/src/modules/message/views/message_view.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class _MessageViewScreenState extends State<MessageViewScreen> {
6060
builder: (context, state) {
6161
if (state is MessageLoading) {
6262
return const Center(
63-
child: CircularProgressIndicator.adaptive(),);
63+
child: CircularProgressIndicator.adaptive(),
64+
);
6465
}
6566
return Builder(
6667
builder: (c) {

lib/src/modules/rooms/cubit/room_cubit.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class RoomCubit extends Cubit<RoomState> {
3535
final scrollController = ScrollController();
3636
String? currentRoomId;
3737

38+
bool isOpenMessageImageOrVideo = false;
39+
3840
void getInstance() {}
3941

4042
Future getRoomsFromLocal() async {

lib/src/modules/video_player/views/video_player_view.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:v_chat_sdk/src/modules/rooms/cubit/room_cubit.dart';
23
import 'package:video_player/video_player.dart' as vd;
34
import 'package:video_viewer/video_viewer.dart';
45

@@ -15,6 +16,19 @@ class _VideoPlayerViewState extends State<VideoPlayerView> {
1516
late vd.VideoPlayerController videoPlayerController;
1617
bool isLoading = true;
1718

19+
@override
20+
void initState() {
21+
super.initState();
22+
RoomCubit.instance.isOpenMessageImageOrVideo = true;
23+
}
24+
25+
@override
26+
void dispose() {
27+
RoomCubit.instance.isOpenMessageImageOrVideo = false;
28+
videoPlayerController.dispose();
29+
super.dispose();
30+
}
31+
1832
@override
1933
Widget build(BuildContext context) {
2034
FocusScope.of(context).unfocus();

0 commit comments

Comments
 (0)