Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade code version #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions lib/components/explore_content_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import 'package:flutter_challenge_googlemaps/helper/ui_helper.dart';

class ExploreContentWidget extends StatelessWidget {
final double currentExplorePercent;
final placeName = const ["Authentic\nrestaurant", "Famous\nmonuments", "Weekend\ngetaways"];
const ExploreContentWidget({Key key, this.currentExplorePercent}) : super(key: key);
final placeName = const [
"Authentic\nrestaurant",
"Famous\nmonuments",
"Weekend\ngetaways"
];
const ExploreContentWidget({Key? key, required this.currentExplorePercent})
: super(key: key);

@override
Widget build(BuildContext context) {
if (currentExplorePercent != 0) {
return Positioned(
top: realH(standardHeight + (162 - standardHeight) * currentExplorePercent),
top: realH(
standardHeight + (162 - standardHeight) * currentExplorePercent),
width: screenWidth,
child: Container(
height: screenHeight,
Expand All @@ -25,7 +31,8 @@ class ExploreContentWidget extends StatelessWidget {
children: <Widget>[
Expanded(
child: Transform.translate(
offset: Offset(screenWidth / 3 * (1 - currentExplorePercent),
offset: Offset(
screenWidth / 3 * (1 - currentExplorePercent),
screenWidth / 3 / 2 * (1 - currentExplorePercent)),
child: Image.asset(
"assets/icon_1.png",
Expand All @@ -43,7 +50,8 @@ class ExploreContentWidget extends StatelessWidget {
),
Expanded(
child: Transform.translate(
offset: Offset(-screenWidth / 3 * (1 - currentExplorePercent),
offset: Offset(
-screenWidth / 3 * (1 - currentExplorePercent),
screenWidth / 3 / 2 * (1 - currentExplorePercent)),
child: Image.asset(
"assets/icon_3.png",
Expand All @@ -56,12 +64,14 @@ class ExploreContentWidget extends StatelessWidget {
),
),
Transform.translate(
offset: Offset(0, realH(23 + 380 * (1 - currentExplorePercent))),
offset:
Offset(0, realH(23 + 380 * (1 - currentExplorePercent))),
child: Opacity(
opacity: currentExplorePercent,
child: Container(
width: screenWidth,
height: realH(172 + (172 * 4 * (1 - currentExplorePercent))),
height: realH(
172 + (172 * 4 * (1 - currentExplorePercent))),
child: ListView(
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
Expand All @@ -79,7 +89,8 @@ class ExploreContentWidget extends StatelessWidget {
),
))),
Transform.translate(
offset: Offset(0, realH(58 + 570 * (1 - currentExplorePercent))),
offset:
Offset(0, realH(58 + 570 * (1 - currentExplorePercent))),
child: Opacity(
opacity: currentExplorePercent,
child: Padding(
Expand All @@ -91,8 +102,10 @@ class ExploreContentWidget extends StatelessWidget {
Padding(
padding: EdgeInsets.only(left: realW(22)),
child: Text("EVENTS",
style:
const TextStyle(color: Colors.white54, fontSize: 13, fontWeight: FontWeight.bold)),
style: const TextStyle(
color: Colors.white54,
fontSize: 13,
fontWeight: FontWeight.bold)),
),
Stack(
children: <Widget>[
Expand All @@ -104,12 +117,17 @@ class ExploreContentWidget extends StatelessWidget {
left: realW(24),
child: Text(
"Marshmello Live in Concert",
style: TextStyle(color: Colors.white, fontSize: realW(16)),
style: TextStyle(
color: Colors.white,
fontSize: realW(16)),
))
],
),
Transform.translate(
offset: Offset(0, realH(30 - 30 * (currentExplorePercent - 0.75) * 4)),
offset: Offset(
0,
realH(30 -
30 * (currentExplorePercent - 0.75) * 4)),
child: Row(
children: <Widget>[
Expanded(
Expand Down
32 changes: 20 additions & 12 deletions lib/components/explore_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ class ExploreWidget extends StatelessWidget {
final bool isExploreOpen;

const ExploreWidget(
{Key key,
this.currentSearchPercent,
this.currentExplorePercent,
this.animateExplore,
this.isExploreOpen,
this.onVerticalDragUpdate,
this.onPanDown})
{Key? key,
required this.currentSearchPercent,
required this.currentExplorePercent,
required this.animateExplore,
required this.isExploreOpen,
required this.onVerticalDragUpdate,
required this.onPanDown})
: super(key: key);

@override
Widget build(BuildContext context) {
return Positioned(
bottom: realH(-122 * currentSearchPercent),
left: (screenWidth - realW(159 + (standardWidth - 159) * currentExplorePercent)) / 2,
left: (screenWidth -
realW(159 + (standardWidth - 159) * currentExplorePercent)) /
2,
child: GestureDetector(
onTap: () {
animateExplore(!isExploreOpen);
Expand All @@ -49,16 +51,21 @@ class ExploreWidget extends StatelessWidget {
Color(0xFF8739E5),
]),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(realW(80 + (50 - 80) * currentExplorePercent)),
topRight: Radius.circular(realW(80 + (50 - 80) * currentExplorePercent)))),
topLeft: Radius.circular(
realW(80 + (50 - 80) * currentExplorePercent)),
topRight: Radius.circular(
realW(80 + (50 - 80) * currentExplorePercent)))),
child: Stack(
children: [
Positioned(
top: realH(65 + (-5 * currentExplorePercent)),
left: realW(49 + (91 - 49) * currentExplorePercent),
child: Text(
"Explore",
style: TextStyle(color: Colors.white, fontSize: realW(18 + (32 - 18) * currentExplorePercent)),
style: TextStyle(
color: Colors.white,
fontSize:
realW(18 + (32 - 18) * currentExplorePercent)),
)),
Positioned(
top: realH(20 + (60 - 20) * currentExplorePercent),
Expand All @@ -71,7 +78,8 @@ class ExploreWidget extends StatelessWidget {
Positioned(
top: realH(currentExplorePercent < 0.9
? realH(-35)
: realH(-35 + (6 + 35) * (currentExplorePercent - 0.9) * 8)),
: realH(-35 +
(6 + 35) * (currentExplorePercent - 0.9) * 8)),
left: realW(63 + (170 - 63) * currentExplorePercent),
child: GestureDetector(
onTap: () {
Expand Down
39 changes: 24 additions & 15 deletions lib/components/map_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class MapButton extends StatelessWidget {
final Gradient gradient;

const MapButton(
{Key key,
this.currentSearchPercent,
this.currentExplorePercent,
this.bottom,
this.offsetX,
this.width,
this.height,
this.icon,
this.iconColor,
{Key? key,
required this.currentSearchPercent,
required this.currentExplorePercent,
required this.bottom,
required this.offsetX,
required this.width,
required this.height,
required this.icon,
required this.iconColor,
this.isRight = true,
this.gradient})
required this.gradient})
: assert(currentExplorePercent != null),
assert(currentExplorePercent != null),
assert(bottom != null),
Expand All @@ -40,8 +40,12 @@ class MapButton extends StatelessWidget {
Widget build(BuildContext context) {
return Positioned(
bottom: realH(bottom),
left: !isRight ? realW(offsetX * (currentExplorePercent + currentSearchPercent)) : null,
right: isRight ? realW(offsetX * (currentExplorePercent + currentSearchPercent)) : null,
left: !isRight
? realW(offsetX * (currentExplorePercent + currentSearchPercent))
: null,
right: isRight
? realW(offsetX * (currentExplorePercent + currentSearchPercent))
: null,
child: Opacity(
opacity: 1 - (currentSearchPercent + currentExplorePercent),
child: Container(
Expand All @@ -58,10 +62,15 @@ class MapButton extends StatelessWidget {
color: gradient == null ? Colors.white : null,
gradient: gradient,
borderRadius: isRight
? BorderRadius.only(bottomLeft: Radius.circular(realW(36)), topLeft: Radius.circular(realW(36)))
: BorderRadius.only(bottomRight: Radius.circular(realW(36)), topRight: Radius.circular(realW(36))),
? BorderRadius.only(
bottomLeft: Radius.circular(realW(36)),
topLeft: Radius.circular(realW(36)))
: BorderRadius.only(
bottomRight: Radius.circular(realW(36)),
topRight: Radius.circular(realW(36))),
boxShadow: [
BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)),
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)),
]),
),
),
Expand Down
Loading