mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 02:54:34 +00:00
web QR dummy screen added
This commit is contained in:
@@ -4,7 +4,9 @@ class AppRoutes {
|
||||
static const splash = '/splash';
|
||||
static const intro = '/intro';
|
||||
static const setupProfile = '/setupProfile';
|
||||
static const home = '/home';
|
||||
static const addContact = '/addContact';
|
||||
static const addContactWeb = '/addContactWeb';
|
||||
static const scanInvitation = '/ScanInvitation';
|
||||
static const addGroup = '/addGroup';
|
||||
}
|
||||
|
||||
@@ -6,17 +6,21 @@ import 'package:simplex_chat/constants.dart';
|
||||
import 'package:simplex_chat/custom_scroll_behavior.dart';
|
||||
import 'package:simplex_chat/providers/drawer_providers.dart';
|
||||
import 'package:simplex_chat/views/contacts/add_contact_view.dart';
|
||||
import 'package:simplex_chat/views/contacts/add_contact_web.dart';
|
||||
import 'package:simplex_chat/views/group/add_group_view.dart';
|
||||
import 'package:simplex_chat/views/home/home_view.dart';
|
||||
import 'package:simplex_chat/views/onboarding/intro_view.dart';
|
||||
import 'package:simplex_chat/views/scan_invitation/scan_invitation_view.dart';
|
||||
import 'package:simplex_chat/views/setup_profile_view.dart';
|
||||
import 'package:simplex_chat/views/splash_screen.dart';
|
||||
import 'package:url_strategy/url_strategy.dart';
|
||||
|
||||
/// Basic Structure is setup on [Providers]
|
||||
/// Navigations are [namedRoutes]
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
setPathUrlStrategy();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -50,7 +54,9 @@ class MyApp extends StatelessWidget {
|
||||
AppRoutes.splash: (_) => const SplashScreen(),
|
||||
AppRoutes.intro: (_) => const IntroView(),
|
||||
AppRoutes.setupProfile: (_) => const SetupProfileView(),
|
||||
AppRoutes.home: (_) => const HomeView(),
|
||||
AppRoutes.addContact: (_) => const AddContactView(),
|
||||
AppRoutes.addContactWeb: (_) => const AddContactWeb(),
|
||||
AppRoutes.scanInvitation: (_) => const ScanInvitationView(),
|
||||
AppRoutes.addGroup: (_) => const AddGroupView(),
|
||||
},
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qr_code_scanner/qr_code_scanner.dart';
|
||||
|
||||
class AddContactWeb extends StatefulWidget {
|
||||
const AddContactWeb({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AddContactWebState createState() => _AddContactWebState();
|
||||
}
|
||||
|
||||
class _AddContactWebState extends State<AddContactWeb> {
|
||||
bool? _dontShow = false;
|
||||
|
||||
// alert dialgoue
|
||||
void _initialWarning() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => StatefulBuilder(
|
||||
builder: (context, setState) => AlertDialog(
|
||||
title: const Text('Are you Sure?'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('Your profile will be sent to your contact!'),
|
||||
const SizedBox(height: 15.0),
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: _dontShow,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_dontShow = value;
|
||||
});
|
||||
}),
|
||||
const Text("Don't ask again")
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Icon(Icons.check, color: Colors.green),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Icon(Icons.cancel_outlined, color: Colors.red),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _intiBox() {
|
||||
Future.delayed(const Duration(seconds: 1), _initialWarning);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_intiBox();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
title: const Text('Add Contact'),
|
||||
),
|
||||
body: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(true),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.red,
|
||||
width: 5.0,
|
||||
),
|
||||
),
|
||||
child: Image.asset('assets/code.png')),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: MediaQuery.of(context).size.height * 0.15,
|
||||
left: MediaQuery.of(context).size.width * 0.41,
|
||||
child: const Text(
|
||||
'Position QR Code within the frame.',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:simplex_chat/animations/bottom_animation.dart';
|
||||
@@ -32,6 +33,7 @@ class _ConversationsState extends State<Conversations> {
|
||||
|
||||
// getting data from local storage FOR NOW!!
|
||||
void _getContacts() async {
|
||||
debugPrint('Getting contacts!');
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final String? _contacts = prefs.getString('contacts');
|
||||
if (_contacts != null) {
|
||||
@@ -43,6 +45,7 @@ class _ConversationsState extends State<Conversations> {
|
||||
|
||||
// getting data from local storage FOR NOW!!
|
||||
void _getGroups() async {
|
||||
debugPrint('Getting groups!');
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final String? _groups = prefs.getString('groups');
|
||||
if (_groups != null) {
|
||||
@@ -55,6 +58,7 @@ class _ConversationsState extends State<Conversations> {
|
||||
}
|
||||
|
||||
void _gettingGroupContactsChats() {
|
||||
debugPrint('Merging!');
|
||||
setState(() {
|
||||
_conversations = List.from(_contactsList);
|
||||
_conversations = _conversations + _groupList;
|
||||
@@ -188,8 +192,8 @@ class _ConversationsState extends State<Conversations> {
|
||||
_addNewMember();
|
||||
}
|
||||
} else if (value == _options[1]) {
|
||||
var newMember =
|
||||
await Navigator.pushNamed(context, AppRoutes.addContact);
|
||||
var newMember = await Navigator.pushNamed(context,
|
||||
kIsWeb ? AppRoutes.addContactWeb : AppRoutes.addContact);
|
||||
newMember ??= false;
|
||||
if (newMember == true) {
|
||||
_addNewMember();
|
||||
@@ -432,6 +436,7 @@ class _ConversationsState extends State<Conversations> {
|
||||
|
||||
_getContacts();
|
||||
_getGroups();
|
||||
|
||||
const snackBar = SnackBar(
|
||||
backgroundColor: Colors.green,
|
||||
content: Text('New contacts loaded!'),
|
||||
|
||||
@@ -15,8 +15,7 @@ import 'package:simplex_chat/views/profile/profile_view.dart';
|
||||
/// Generate [Fake Contacts] by tapping the [Bug Icon]
|
||||
|
||||
class HomeView extends StatefulWidget {
|
||||
final double maxSlide;
|
||||
const HomeView({Key? key, required this.maxSlide}) : super(key: key);
|
||||
const HomeView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HomeViewState createState() => _HomeViewState();
|
||||
@@ -105,6 +104,7 @@ class _HomeViewState extends State<HomeView> {
|
||||
_drawerProviders.currentIndex = 0;
|
||||
},
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
backgroundImage: _photo!.isEmpty
|
||||
? const AssetImage('assets/dp.png')
|
||||
as ImageProvider
|
||||
|
||||
@@ -20,7 +20,7 @@ class IntroView extends StatelessWidget {
|
||||
'assets/logo.svg',
|
||||
height: 80.0,
|
||||
),
|
||||
const SizedBox(height: 50.0),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.05),
|
||||
const Text(
|
||||
'Complete your profile to begin using SimpleX. Your profile is local to your device and will help identify you to your connections.',
|
||||
style: kMediumHeadingStyle,
|
||||
|
||||
@@ -85,10 +85,12 @@ class _ProfileViewState extends State<ProfileView> {
|
||||
children: [
|
||||
_photo != ''
|
||||
? CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
radius: 100.0,
|
||||
backgroundImage: FileImage(File(_photo!)),
|
||||
)
|
||||
: const CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
radius: 100.0,
|
||||
backgroundImage: AssetImage('assets/dp.png'),
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:simplex_chat/app_routes.dart';
|
||||
import 'package:simplex_chat/constants.dart';
|
||||
import 'package:simplex_chat/views/home/home_view.dart';
|
||||
import 'package:simplex_chat/widgets/custom_text_field.dart';
|
||||
@@ -62,10 +63,12 @@ class _SetupProfileViewState extends State<SetupProfileView> {
|
||||
children: [
|
||||
_imageUploaded
|
||||
? CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
radius: 100.0,
|
||||
backgroundImage: FileImage(image!),
|
||||
)
|
||||
: const CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
radius: 100.0,
|
||||
backgroundImage: AssetImage('assets/dp.png'),
|
||||
),
|
||||
@@ -141,14 +144,7 @@ class _SetupProfileViewState extends State<SetupProfileView> {
|
||||
|
||||
await _createProfile();
|
||||
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => HomeView(
|
||||
maxSlide: MediaQuery.of(context).size.width * 0.82,
|
||||
),
|
||||
),
|
||||
);
|
||||
await Navigator.pushNamed(context, AppRoutes.home);
|
||||
|
||||
_displayNameController.clear();
|
||||
_fullNameController.clear();
|
||||
|
||||
@@ -434,6 +434,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
url_strategy:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: url_strategy
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -64,6 +64,7 @@ dev_dependencies:
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_launcher_icons: ^0.9.2
|
||||
url_strategy: ^0.2.0
|
||||
|
||||
flutter_icons:
|
||||
image_path: "assets/x.png"
|
||||
|
||||
Reference in New Issue
Block a user