1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
-
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:amap_flutter_base/amap_flutter_base.dart';
- import 'package:farmer_client/widgets/amap/amap.dart';
-
- import '../../widgets/summary.dart';
-
- Widget page({ required BuildContext context, required Size appbarSize, required void Function() handleClick}) {
- final _offset = 20.w;
- final width = MediaQuery.of(context).size.width;
- final height = MediaQuery.of(context).size.height
- - appbarSize.height
- - MediaQuery.of(context).padding.top;
- final mapHeight = height * 0.3;
- final cardHeight = (height - mapHeight) / 2 + _offset;
-
-
- final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
- final LatLng position = LatLng(32.690712, 112.091892);
-
- return Stack(
- alignment: Alignment.topCenter,
- children: [
- // 第一个组件用来撑满全屏
- SizedBox(
- width: width,
- height: height,
- ),
- SizedBox(
- width: width,
- height: mapHeight,
- child: AMap(position: position),
- ),
- Positioned(
- left: 0,
- top: mapHeight - _offset,
- height: cardHeight,
- child: _thumb(context, img),
- ),
- Positioned(
- left: 0,
- top: mapHeight + cardHeight - 2 * _offset,
- height: cardHeight,
- child: _content(context, handleClick),
- ),
- ],);
- }
-
- Widget _card(BuildContext context, Widget child) {
- final _border = 20.w;
- return Container(
- width: MediaQuery.of(context).size.width,
- clipBehavior: Clip.hardEdge,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
- ),
- child: child,
- );
- }
-
- Widget _thumb(BuildContext context, String imgUrl) {
- return _card(context, Image.network(imgUrl, fit: BoxFit.cover));
- }
-
-
- Widget _button(void Function() handleClick) {
- return ElevatedButton(
- child: const Text("预约"),
- style: ElevatedButton.styleFrom(
- primary: const Color(0xFFFF703B),
- textStyle: TextStyle(color: Colors.white, fontSize: 20.sp, letterSpacing: 5.sp),
- elevation: 0,
- minimumSize: Size(double.infinity, 49.w),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(Radius.circular(24.5.w)),
- )
- ),
- onPressed: handleClick,
- );
- }
-
- Widget _content(BuildContext context, void Function() handleClick) {
- return _card(context, Container(
- padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
- decoration: const BoxDecoration(
- color: Colors.white,
- ),
- child: Column(
-
- children: [
- summary(),
- _button(handleClick),
- ],
- ),
- ));
- }
|