地址接口的视线
This commit is contained in:
105
lib/pages/mh_page/homepage/component/citypicker.dart
Normal file
105
lib/pages/mh_page/homepage/component/citypicker.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_city_picker/listener/picker_listener.dart';
|
||||
import 'package:flutter_city_picker/model/address.dart';
|
||||
import 'package:flutter_city_picker/view/city_picker.dart';
|
||||
|
||||
class CityPicker {
|
||||
/// 展示
|
||||
static void show({
|
||||
required BuildContext context,
|
||||
AnimationController? animController,
|
||||
double opacity = 0.5,
|
||||
bool dismissible = true,
|
||||
double height = 500.0,
|
||||
double titleHeight = 50.0,
|
||||
double corner = 20.0,
|
||||
Color? backgroundColor,
|
||||
double paddingLeft = 15.0,
|
||||
Widget? titleWidget,
|
||||
String? selectText,
|
||||
Widget? closeWidget,
|
||||
double tabHeight = 40.0,
|
||||
bool showTabIndicator = true,
|
||||
double tabPadding = 10.0,
|
||||
Color? tabIndicatorColor,
|
||||
double tabIndicatorHeight = 3.0,
|
||||
double labelTextSize = 15.0,
|
||||
Color? selectedLabelColor,
|
||||
Color? unselectedLabelColor,
|
||||
double itemHeadHeight = 30.0,
|
||||
Color? itemHeadBackgroundColor,
|
||||
Color? itemHeadLineColor,
|
||||
double itemHeadLineHeight = 0.1,
|
||||
TextStyle? itemHeadTextStyle,
|
||||
double itemHeight = 40.0,
|
||||
double indexBarWidth = 28,
|
||||
double indexBarItemHeight = 20,
|
||||
Color indexBarBackgroundColor = Colors.black12,
|
||||
TextStyle? indexBarTextStyle,
|
||||
Widget? itemSelectedIconWidget,
|
||||
TextStyle? itemSelectedTextStyle,
|
||||
TextStyle? itemUnSelectedTextStyle,
|
||||
List<AddressNode>? initialAddress,
|
||||
required CityPickerListener cityPickerListener,
|
||||
}) {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.black.withOpacity(opacity),
|
||||
barrierDismissible: dismissible,
|
||||
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
||||
transitionDuration: const Duration(milliseconds: 300),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(corner),
|
||||
topRight: Radius.circular(corner),
|
||||
),
|
||||
),
|
||||
child: CityPickerWidget(
|
||||
height: height,
|
||||
titleHeight: titleHeight,
|
||||
corner: corner,
|
||||
backgroundColor: backgroundColor,
|
||||
paddingLeft: paddingLeft,
|
||||
titleWidget: titleWidget,
|
||||
selectText: selectText,
|
||||
closeWidget: closeWidget,
|
||||
tabHeight: tabHeight,
|
||||
showTabIndicator: showTabIndicator,
|
||||
tabPadding: tabPadding,
|
||||
tabIndicatorColor: tabIndicatorColor,
|
||||
tabIndicatorHeight: tabIndicatorHeight,
|
||||
labelTextSize: labelTextSize,
|
||||
selectedLabelColor: selectedLabelColor,
|
||||
unselectedLabelColor: unselectedLabelColor,
|
||||
itemHeadHeight: itemHeadHeight,
|
||||
itemHeadBackgroundColor: itemHeadBackgroundColor,
|
||||
itemHeadLineColor: itemHeadLineColor,
|
||||
itemHeadLineHeight: itemHeadLineHeight,
|
||||
itemHeadTextStyle: itemHeadTextStyle,
|
||||
itemHeight: itemHeight,
|
||||
indexBarWidth: indexBarWidth,
|
||||
indexBarItemHeight: indexBarItemHeight,
|
||||
indexBarBackgroundColor: indexBarBackgroundColor,
|
||||
indexBarTextStyle: indexBarTextStyle,
|
||||
itemSelectedIconWidget: itemSelectedIconWidget,
|
||||
itemSelectedTextStyle: itemSelectedTextStyle,
|
||||
itemUnSelectedTextStyle: itemUnSelectedTextStyle,
|
||||
initialAddress: initialAddress,
|
||||
cityPickerListener: cityPickerListener,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
}),
|
||||
const Spacer(), // 左右分隔
|
||||
FloatingSvgIcon(
|
||||
assetPath: 'assets/img/icon/xiaoe.svg',
|
||||
assetPath: 'assets/img/icon/xiaoyi.svg',
|
||||
width: 60.rpx,
|
||||
height: 60.rpx,
|
||||
onTap: () {
|
||||
@@ -463,7 +463,7 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
),
|
||||
fillColor:
|
||||
stringToColor(
|
||||
"#184468"),
|
||||
"##011D33"),
|
||||
elevation: 2,
|
||||
borderColor:
|
||||
Colors.transparent,
|
||||
@@ -482,6 +482,7 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
isMultiSelect: false,
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
@@ -559,7 +560,8 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
.value
|
||||
.length, (index) {
|
||||
var day = homeController
|
||||
.homeSleepDays[index];
|
||||
.homeSleepDays[
|
||||
index];
|
||||
bool isSelected =
|
||||
homeController
|
||||
.selectedDayIndex
|
||||
@@ -607,7 +609,7 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
BoxDecoration(
|
||||
color: isSelected
|
||||
? stringToColor(
|
||||
"#184468")
|
||||
"#011D33")
|
||||
: Colors
|
||||
.transparent,
|
||||
borderRadius:
|
||||
|
||||
Reference in New Issue
Block a user