Skip to content

Commit

Permalink
feat: N beacon 1 Group (#169)
Browse files Browse the repository at this point in the history
* model changes

* added group in models

* queries updated

* queries updated

* model changes

* service changes

* constants updated

* yaml file updated

* routing changes

* readme updates

* debugged model changes

* queries updated

* components added

* mutation functions primary

* view model additions

* screen additions

* flutter analyze error resolved

* showing user beacons in group screen

* back from hike to group screen

* todo navigation changes

* flutter analyze issues

* Flutter version

Updated minimum required Flutter version in Readme
  • Loading branch information
ItsAdityaKSingh committed Oct 17, 2022
1 parent be1a0e5 commit c3dcbeb
Show file tree
Hide file tree
Showing 24 changed files with 1,334 additions and 151 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You'll need to set up the IDE and mobile device emulator, or any mobile testing
1. [Flutter SDK](https://flutter.dev/docs/get-started/install)
2. [Android Studio](https://developer.android.com/studio)

***Ensure you are testing the app using Flutter version [2.10](https://docs.flutter.dev/development/tools/sdk/releases?tab=windows) and above.***
***Ensure you are testing the app using Flutter version [3.0.1](https://docs.flutter.dev/development/tools/sdk/releases?tab=windows) and above.***

For checking flutter version:
- Run `flutter --version` in terminal
Expand Down Expand Up @@ -48,7 +48,7 @@ beacon/lib/
├── components/ # Shared Components such as dialog boxes, button, and other shared widgets
├── enums/ # enum files
| └── view_state.dart # defines view states i.e Idle, Busy, Error
├── models/ # model classes: beacon, location, landmark, user
├── models/ # model classes: group, beacon, location, landmark, user
├── queries/ # includes all graphql query strings
├── services/ # services
| ├── database_mutation_function.dart/ # Graphql Queries implementations
Expand All @@ -59,6 +59,7 @@ beacon/lib/
| ├── auth_screen.dart
| ├── base_view.dart
| ├── hike_screen.dart
| ├── group_screen.dart
| ├── home.dart
├── viewmodels/ # Viewmodels layer
├── splash_screen.dart # Very first screen displayed whilst data is loading
Expand Down
156 changes: 151 additions & 5 deletions lib/components/create_join_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,160 @@ import 'package:beacon/locator.dart';
import 'package:beacon/services/validators.dart';
import 'package:beacon/components/hike_button.dart';
import 'package:beacon/utilities/constants.dart';
import 'package:beacon/view_model/home_view_model.dart';
import 'package:beacon/view_model/group_screen_view_model.dart';
import 'package:duration_picker/duration_picker.dart';
import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';

import '../view_model/home_screen_view_model.dart';

class CreateJoinGroupDialog {
static Future createGroupDialog(BuildContext context, HomeViewModel model) {
bool isSmallSized = MediaQuery.of(context).size.height < 800;
return showDialog(
context: context,
builder: (context) => GestureDetector(
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
child: Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: SingleChildScrollView(
child: Form(
key: model.formKeyCreate,
child: Container(
height: isSmallSized ? 35.h : 25.h,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
child: Column(
children: <Widget>[
Container(
height: isSmallSized ? 12.h : 10.h,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextFormField(
style: TextStyle(fontSize: 22.0),
validator: (value) =>
Validator.validateBeaconTitle(value),
onChanged: (name) {
model.title = name;
},
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter Title Here',
labelStyle: TextStyle(
fontSize: labelsize, color: kYellow),
hintStyle: TextStyle(
fontSize: hintsize, color: hintColor),
labelText: 'Title',
alignLabelWithHint: true,
floatingLabelBehavior:
FloatingLabelBehavior.always,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none),
),
),
color: kLightBlue,
),
SizedBox(
height: 2.h,
),
Flexible(
flex: 2,
child: HikeButton(
text: 'Create Group',
textSize: 18.0,
textColor: Colors.white,
buttonColor: kYellow,
onTap: () {
// FocusManager.instance.primaryFocus?.unfocus();
// navigationService.pop();
model.createGroupRoom();
}),
),
],
),
),
),
),
),
),
),
);
}

static Future joinGroupDialog(BuildContext context, HomeViewModel model) {
bool isSmallSized = MediaQuery.of(context).size.height < 800;
return showDialog(
context: context,
builder: (context) => Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: Form(
key: model.formKeyJoin,
child: Container(
height: isSmallSized ? 35.h : 25.h,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
child: Column(
children: <Widget>[
Container(
height: isSmallSized ? 12.h : 10.h,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextFormField(
keyboardType: TextInputType.text,
textCapitalization: TextCapitalization.characters,
style: TextStyle(fontSize: 22.0),
validator: (value) => Validator.validatePasskey(value),
onChanged: (key) {
model.enteredGroupCode = key.toUpperCase();
},
decoration: InputDecoration(
alignLabelWithHint: true,
floatingLabelBehavior: FloatingLabelBehavior.always,
hintText: 'Enter Group Code Here',
hintStyle:
TextStyle(fontSize: hintsize, color: hintColor),
labelText: 'Code',
labelStyle:
TextStyle(fontSize: labelsize, color: kYellow),
border: InputBorder.none,
),
),
),
color: kLightBlue,
),
SizedBox(
height: 2.h,
),
Flexible(
child: HikeButton(
text: 'Join Group',
textSize: 18.0,
textColor: Colors.white,
buttonColor: kYellow,
onTap: () {
// navigationService.pop();
model.joinGroupRoom();
},
),
),
],
),
),
),
),
),
);
}
}

class CreateJoinBeaconDialog {
static Future createHikeDialog(
BuildContext context, HomeViewModel model, Function reloadList) {
static Future createHikeDialog(BuildContext context, GroupViewModel model,
Function reloadList, String groupID) {
bool isSmallSized = MediaQuery.of(context).size.height < 800;
model.resultingDuration = Duration(minutes: 30);
model.durationController = new TextEditingController();
Expand Down Expand Up @@ -280,7 +426,7 @@ class CreateJoinBeaconDialog {
"Enter a valid date and time!!");
return;
}
model.createHikeRoom(reloadList);
model.createHikeRoom(groupID, reloadList);
}),
),
],
Expand All @@ -295,7 +441,7 @@ class CreateJoinBeaconDialog {
}

static Future joinBeaconDialog(
BuildContext context, HomeViewModel model, Function reloadList) {
BuildContext context, GroupViewModel model, Function reloadList) {
bool isSmallSized = MediaQuery.of(context).size.height < 800;
return showDialog(
context: context,
Expand Down
11 changes: 7 additions & 4 deletions lib/components/dialog_boxes.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:beacon/components/hike_button.dart';
import 'package:beacon/locator.dart';
import 'package:beacon/utilities/constants.dart';
import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
Expand Down Expand Up @@ -35,9 +34,13 @@ class DialogBoxes {
HikeButton(
buttonHeight: 2.5.h,
buttonWidth: 8.w,
onTap: () {
navigationService.removeAllAndPush('/main', '/');
},
onTap: () => Navigator.of(context).pop(true),
//TODO:
// onTap: () {
// navigationService.removeAllAndPush('/groupScreen', '/',
// arguments: GroupScreen(
// group,
// ));
text: 'Yes',
textSize: 18.0,
),
Expand Down
Loading

0 comments on commit c3dcbeb

Please sign in to comment.