Skip to content

Commit

Permalink
Change the entire not serviceable flow
Browse files Browse the repository at this point in the history
  • Loading branch information
AshutoshPatole committed Nov 13, 2021
1 parent d6386d0 commit b1b01f0
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 108 deletions.
191 changes: 98 additions & 93 deletions lib/views/home_page/home_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,102 +30,107 @@ class HomePageView extends StatelessWidget {
builder: (context, snapshot) {
return viewModel.serviceableDistance < 0
? const GetLocationCircularProgressIndicator()
: viewModel.isServiceableDistance
? SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
HomeHeader(address: viewModel.address),
SizedBox(
height: size.height * 0.05,
),
GestureDetector(
onTap: () {
// TODO : Open a page with terms and condition for the coupon code.
},
child: const Coupon(),
),
SizedBox(
height: size.height * 0.05,
),
const Text(
"Categories",
style: AppTheme.title,
),
SizedBox(
height: size.height * 0.25,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: const BouncingScrollPhysics(),
itemCount: mockFood.length,
itemBuilder: (context, index) {
final data = mockFood[index];
return GestureDetector(
onTap: () {
viewModel.setFoodHolderProps(
foodImagePath: data.imageLink,
foodName: data.name,
foodTag:
'${data.imageLink}-$index,',
foodPrice: data.price);
viewModel.navigateItemDetailPage();
},
child: Container(
width: size.width * 0.35,
height: size.height * 0.1,
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: AppTheme.primaryColor,
borderRadius:
BorderRadius.circular(20.0),
boxShadow: [
BoxShadow(
color: AppTheme.primaryColor
.withOpacity(0.75),
spreadRadius: 1,
blurRadius: 5,
offset: const Offset(2, 4.5),
)
],
: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
HomeHeader(address: viewModel.address),
SizedBox(
height: size.height * 0.01,
),
viewModel.isServiceableDistance
? SizedBox(
height: size.height * 0.03,
)
: const NotServiceableLocation(),
SizedBox(
height: size.height * 0.02,
),
GestureDetector(
onTap: () {
// TODO : Open a page with terms and condition for the coupon code.
},
child: const Coupon(),
),
SizedBox(
height: size.height * 0.05,
),
const Text(
"Categories",
style: AppTheme.title,
),
SizedBox(
height: size.height * 0.25,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: const BouncingScrollPhysics(),
itemCount: mockFood.length,
itemBuilder: (context, index) {
final data = mockFood[index];
return GestureDetector(
onTap: () {
viewModel.setFoodHolderProps(
foodImagePath: data.imageLink,
foodName: data.name,
foodTag:
'${data.imageLink}-$index,',
foodPrice: data.price);
viewModel.navigateItemDetailPage();
},
child: Container(
width: size.width * 0.35,
height: size.height * 0.1,
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: AppTheme.primaryColor,
borderRadius:
BorderRadius.circular(20.0),
boxShadow: [
BoxShadow(
color: AppTheme.primaryColor
.withOpacity(0.75),
spreadRadius: 1,
blurRadius: 5,
offset: const Offset(2, 4.5),
)
],
),
child: Column(
children: [
SizedBox(
height: size.height * 0.025,
),
child: Column(
children: [
SizedBox(
height: size.height * 0.025,
),
Hero(
tag:
'${mockFood[index].imageLink}-$index,',
child: Image.asset(
data.imageLink,
),
),
const Spacer(),
Text(
data.name,
style: const TextStyle(
color: Colors.white,
fontSize: 16.0,
),
),
],
Hero(
tag:
'${mockFood[index].imageLink}-$index,',
child: Image.asset(
data.imageLink,
),
),
),
);
},
),
),
],
const Spacer(),
Text(
data.name,
style: const TextStyle(
color: Colors.white,
fontSize: 16.0,
),
),
],
),
),
);
},
),
),
),
)
: const NotServiceableLocation();
],
),
),
);
},
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/views/home_page/home_page_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HomePageViewModel extends BaseViewModel {
serviceableDistance = Geolocator.distanceBetween(
locationData.latitude!,
locationData.longitude!,
12.7806459999,
20.7806459999,
80.2186767,
) /
1000;
Expand Down
44 changes: 30 additions & 14 deletions lib/widgets/dumb_widgets/not_serviceable_location.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

class NotServiceableLocation extends StatelessWidget {
const NotServiceableLocation({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/svg/nolocation.svg',
height: 300,
width: 300,
),
const Padding(
padding: EdgeInsets.all(16.0),
child: Text(
"Sorry! We are not available at this location till now but we hope reaching your nearest location soon.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w600,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 32.0),
child: Container(
width: size.width,
height: size.height * 0.04,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(
CupertinoIcons.info_circle,
size: 20.0,
color: Colors.red,
),
SizedBox(
width: 10,
),
Text(
"Sorry! We are not available at this location",
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
color: Colors.red,
),
),
],
),
),
)
Expand Down

0 comments on commit b1b01f0

Please sign in to comment.