Skip to content

Commit

Permalink
Updated UI, fixed bugs and refactored code (#45)
Browse files Browse the repository at this point in the history
* Updated UI, fixed bugs and refactored code
* checks
* formatted constants
* issue fixed
* checks fixed
* issue
* unused import
* inserted a comma
* changed font-size
* added a comma
* unused code removed
* checks
  • Loading branch information
ItsAdityaKSingh committed Jan 12, 2022
1 parent e91b24c commit feae73f
Show file tree
Hide file tree
Showing 10 changed files with 457 additions and 421 deletions.
354 changes: 153 additions & 201 deletions lib/components/create_join_dialog.dart

Large diffs are not rendered by default.

83 changes: 43 additions & 40 deletions lib/components/dialog_boxes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class DialogBoxes {
buttonWidth: 8.w,
onTap: () => Navigator.of(context).pop(false),
text: 'No',
textSize: 18.0,
),
HikeButton(
buttonHeight: 2.5.h,
Expand All @@ -35,55 +36,57 @@ class DialogBoxes {
navigationService.removeAllAndPush('/main', '/');
},
text: 'Yes',
textSize: 18.0,
),
],
);
}

static Future changeDurationDialog(BuildContext context) {
return showDialog(
context: context,
builder: (context) => Dialog(
child: Container(
height: 500,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
child: Column(
children: <Widget>[
Flexible(
child: Container(
color: kLightBlue,
child: Column(
children: <Widget>[
Text(
'Change Beacon Duration',
style: TextStyle(color: kYellow, fontSize: 12),
),
],
),
context: context,
builder: (context) => Dialog(
child: Container(
height: 500,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
child: Column(
children: <Widget>[
Flexible(
child: Container(
color: kLightBlue,
child: Column(
children: <Widget>[
Text(
'Change Beacon Duration',
style: TextStyle(color: kYellow, fontSize: 14.0),
),
),
SizedBox(
height: 30,
),
Flexible(
child: HikeButton(
buttonWidth: 48,
text: 'Done',
textColor: Colors.white,
buttonColor: kYellow,
onTap: () {
// DateTime newTime =
// DateTime.now().add(newDuration);
// update time
Navigator.pop(context);
}),
),
],
],
),
),
),
),
));
SizedBox(
height: 3.h,
),
Flexible(
child: HikeButton(
buttonWidth: optbwidth,
text: 'Done',
textSize: 18.0,
textColor: Colors.white,
buttonColor: kYellow,
onTap: () {
// DateTime newTime =
// DateTime.now().add(newDuration);
// update time
Navigator.pop(context);
}),
),
],
),
),
),
),
);
}
}
2 changes: 1 addition & 1 deletion lib/components/hike_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HikeButton extends StatelessWidget {
this.buttonColor = kYellow,
this.text,
this.textColor = Colors.white,
this.buttonWidth = 32,
this.buttonWidth = 32, //button sizes have been defined in constants.dart
this.buttonHeight = 32,
this.textSize = 18});

Expand Down
15 changes: 10 additions & 5 deletions lib/components/hike_screen_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:share/share.dart';
import 'package:sizer/sizer.dart';

class HikeScreenWidget {
static copyPasskey(String passkey) {
Expand All @@ -24,7 +25,7 @@ class HikeScreenWidget {
context: context,
builder: (context) => Dialog(
child: Container(
height: 400,
height: 35.h,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 32, vertical: 16),
Expand All @@ -40,11 +41,13 @@ class HikeScreenWidget {
),
),
SizedBox(
height: 30,
height: 3.h,
),
Flexible(
child: HikeButton(
textSize: 20,
buttonHeight: optbheight,
buttonWidth: optbwidth,
textSize: 18,
text: 'Generate URL',
textColor: Colors.white,
buttonColor: kYellow,
Expand All @@ -54,11 +57,13 @@ class HikeScreenWidget {
}),
),
SizedBox(
height: 10,
height: 1.h,
),
Flexible(
child: HikeButton(
textSize: 20,
buttonHeight: optbheight * 1,
buttonWidth: optbwidth,
textSize: 18,
text: 'Copy Passkey',
textColor: Colors.white,
buttonColor: kYellow,
Expand Down
22 changes: 12 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ void main() async {
await Hive.openBox<User>('currentUser');
await Hive.openBox<Beacon>('beacons');
setupLocator();
runApp(OverlaySupport(
child: Sizer(
builder: (context, orientation, deviceType) => MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Beacon',
navigatorKey: navigationService.navigatorKey,
theme: ThemeData(fontFamily: 'FuturaBold'),
initialRoute: '/',
onGenerateRoute: router.generateRoute,
runApp(
OverlaySupport(
child: Sizer(
builder: (context, orientation, deviceType) => MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Beacon',
navigatorKey: navigationService.navigatorKey,
theme: ThemeData(fontFamily: 'FuturaBold'),
initialRoute: '/',
onGenerateRoute: router.generateRoute,
),
),
),
));
);
}

class DemoPageView extends StatelessWidget {
Expand Down
10 changes: 10 additions & 0 deletions lib/utilities/constants.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:sizer/sizer.dart';

const Color kYellow = Color(0xFFFDBB2C);
const Color kBlue = Color(0xFF222375);
const Color kLightBlue = Color(0xFFE8F1F8);
const Color kBlack = Color(0xFF343434);
const Color shimmerSkeletonColor = Color(0xff4e4f91);
const Color hintColor = Colors.black54; // Hint Text Color
const double CAMERA_ZOOM = 15;
const double CAMERA_TILT = 80;
const double CAMERA_BEARING = 30;

// Button Sizings
final double labelsize = 20;
final double hintsize = 18;
final double homebheight = 4.45.h;
final double homebwidth = 3.w;
final double optbheight = 3.5.h;
final double optbwidth = 8.w;

class AppConstants {
static Future<LatLng> getLocation() async {
bool serviceEnabled;
Expand Down
2 changes: 1 addition & 1 deletion lib/view_model/home_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class HomeViewModel extends BaseModel {
}
//Snackbar is displayed by joinBeacon itself on any error or trying to join expired beacon.
} else {
navigationService.showSnackBar('Enter valid passkey');
navigationService.showSnackBar('Enter Valid Passkey');
}
}

Expand Down
Loading

0 comments on commit feae73f

Please sign in to comment.