create new GoToMap widget

This commit is contained in:
ashilkn 2024-02-23 11:22:36 +05:30
parent 4f108b1239
commit 6105af0d0b
5 changed files with 115 additions and 0 deletions

BIN
assets/2.0x/map_world.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
assets/3.0x/map_world.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
assets/earth_blurred.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/map_world.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -96,6 +96,7 @@ class _LocationsSectionState extends State<LocationsSection> {
);
} else {
final recommendations = <Widget>[
const GoToMap2(),
..._locationsSearchResults.map(
(locationSearchResult) =>
LocationRecommendation(locationSearchResult),
@ -315,3 +316,117 @@ class LocationRecommendation extends StatelessWidget {
);
}
}
class GoToMap2 extends StatelessWidget {
static const _width = 100.0;
static const _height = 123.0;
static const _outerCornerRadius = 12.0;
static const _cornerSmoothing = 1.0;
static const _sideOfThumbnail = 90.0;
static const _outerStrokeWidth = 1.0;
//This is the space between this widget's boundary and the border stroke of
//thumbnail.
static const _outerPadding = 4.0;
const GoToMap2({super.key});
@override
Widget build(BuildContext context) {
final enteTextTheme = getEnteTextTheme(context);
return Padding(
padding:
EdgeInsets.symmetric(horizontal: max(0, 2.5 - _outerStrokeWidth)),
child: GestureDetector(
onTap: () {},
child: Stack(
alignment: Alignment.center,
children: [
ClipSmoothRect(
radius: SmoothBorderRadius(
cornerRadius: _outerCornerRadius + _outerStrokeWidth,
cornerSmoothing: _cornerSmoothing,
),
child: Container(
color: Colors.white.withOpacity(0.1),
width: _width + _outerStrokeWidth * 2,
height: _height + _outerStrokeWidth * 2,
),
),
SizedBox(
width: _width,
height: _height,
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
boxShadow: [
BoxShadow(
blurRadius: 1,
offset: Offset(0, 1),
color: Color.fromRGBO(0, 0, 0, 0.09),
blurStyle: BlurStyle.outer,
),
BoxShadow(
blurRadius: 1,
offset: Offset(1, 2),
color: Color.fromRGBO(0, 0, 0, 0.05),
blurStyle: BlurStyle.outer,
),
],
),
child: ClipSmoothRect(
radius: SmoothBorderRadius(
cornerRadius: _outerCornerRadius,
cornerSmoothing: _cornerSmoothing,
),
child: Stack(
clipBehavior: Clip.none,
children: [
Image.asset("assets/earth_blurred.png"),
Padding(
padding: const EdgeInsets.fromLTRB(
_outerPadding,
_outerPadding,
_outerPadding,
_outerPadding,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: _sideOfThumbnail,
height: _sideOfThumbnail,
child: Image.asset("assets/map_world.png"),
),
const SizedBox(height: 4),
Expanded(
child: SizedBox(
width: 90,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Your Map",
style: enteTextTheme.mini.copyWith(
color: Colors.white,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
],
),
),
),
],
),
),
],
),
),
),
),
],
),
),
);
}
}