Skip to content

Commit

Permalink
Merge pull request #13 from bestkid1234/Fix-visual-bug
Browse files Browse the repository at this point in the history
Visual bugs solved
  • Loading branch information
ousvat authored Feb 6, 2021
2 parents cabc0fc + 8d27b6a commit 39479a2
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 116 deletions.
7 changes: 6 additions & 1 deletion lib/components/crew_alert_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CrewAlertDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
print('Height: ' + size.height.toString());
return Container(
color: Colors.white.withOpacity(.2),
width: size.width,
Expand All @@ -32,7 +33,11 @@ class CrewAlertDialog extends StatelessWidget {
filter: ImageFilter.blur(sigmaX: 20.0, sigmaY: 20.0),
child: Center(
child: Container(
height: size.height / 2 + (heightRegulation ?? 0),
height: size.height < 650
? size.height / 2 + 70 + (heightRegulation ?? 0)
: (size.height < 400
? size.height - 20 + (heightRegulation ?? 0)
: size.height / 2 + (heightRegulation ?? 0)),
width: size.width - 60,
decoration: new BoxDecoration(
shape: BoxShape.rectangle,
Expand Down
235 changes: 120 additions & 115 deletions lib/screens/02-Home-Screen/components/home_screen_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,126 @@ class _HomeScreenBodyState extends State<HomeScreenBody> {
children: [
Stack(
children: [
//* Scan Receipt card
ListView(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
children: [
SizedBox(height: 140),
Container(
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Card(
color: Colors.white,
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14.0),
),
child: Container(
width: width - 80,
child: Column(
children: [
SizedBox(height: 50),
Text(
'Earn a reward after every 7 stamps.\nOne stamp equals \$20',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15),
textAlign: TextAlign.center,
),
SizedBox(height: 50),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
CircleWithStamp(
haveStamp: stamps > 0 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 1 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 2 ? true : false,
),
],
),
SizedBox(height: 20),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
CircleWithStamp(
haveStamp: stamps > 3 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 4 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 5 ? true : false,
),
],
),
SizedBox(height: 40),
Container(
width: width / 5,
height: width / 5,
margin: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Colors.red.withOpacity(.15),
shape: BoxShape.circle,
),
child: Center(
child: Icon(
CrewIcons.gift,
color: Theme.of(context).accentColor,
size: width / 8,
),
),
),
SizedBox(height: 20),
Container(
width: width / 2,
child: FlatButton(
child: Text(
"SCAN RECEIPT",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500),
),
textColor: Colors.white,
color: Theme.of(context).primaryColor,
padding: EdgeInsets.all(16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8)),
),
onPressed: () async {
WidgetsFlutterBinding.ensureInitialized();
final cameras = await availableCameras();
final firstCamera = cameras.first;

Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
TakePhotoScreen(
camera: firstCamera)));
},
),
),
],
),
),
)
],
),
),
SizedBox(height: 30),
],
),
//* Top logo
Positioned(
height: 120,
Expand Down Expand Up @@ -70,121 +190,6 @@ class _HomeScreenBodyState extends State<HomeScreenBody> {
),
),
),

//* Scan Receipt card
Positioned(
top: 140,
child: Container(
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Card(
color: Colors.white,
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14.0),
),
child: Container(
width: width - 80,
child: Column(
children: [
SizedBox(height: 50),
Text(
'Earn a reward after every 7 stamps.\nOne stamp equals \$20',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
textAlign: TextAlign.center,
),
SizedBox(height: 50),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
CircleWithStamp(
haveStamp: stamps > 0 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 1 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 2 ? true : false,
),
],
),
SizedBox(height: 20),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
CircleWithStamp(
haveStamp: stamps > 3 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 4 ? true : false,
),
CircleWithStamp(
haveStamp: stamps > 5 ? true : false,
),
],
),
SizedBox(height: 40),
Container(
width: width / 5,
height: width / 5,
margin: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Colors.red.withOpacity(.15),
shape: BoxShape.circle,
),
child: Center(
child: Icon(
CrewIcons.gift,
color: Theme.of(context).accentColor,
size: width / 8,
),
),
),
SizedBox(height: 20),
Container(
width: width / 2,
child: FlatButton(
child: Text(
"SCAN RECEIPT",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500),
),
textColor: Colors.white,
color: Theme.of(context).primaryColor,
padding: EdgeInsets.all(16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8)),
),
onPressed: () async {
WidgetsFlutterBinding.ensureInitialized();
final cameras = await availableCameras();
final firstCamera = cameras.first;

Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
TakePhotoScreen(
camera: firstCamera)));
},
),
),
],
),
),
)
],
),
),
),
],
),
showLoading
Expand Down

0 comments on commit 39479a2

Please sign in to comment.