我正在尝试在地图下方制作一个地图和按钮,它调用 ModalBottomSheetBar 并在其中包含一个表单,但我收到一个错误,有人知道下面的代码有什么问题吗?
它给出“在此消费者小部件上方找不到正确的提供者”,我没有在日志中显示错误
RaisedButton(
child: const Text('SHOW BOTTOM SHEET'),
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return Container(
height: 370,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Consumer<LocationProvider>(
builder: (context, locationProvider, _) {
return Padding(
padding: const EdgeInsets.only(
bottom: 16.0,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Form(
key: _deliveryAddressFormKey,
child: Column(
children: <Widget>[
Container(
height: 50,
color: Theme.of(context).accentColor,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Expanded(
flex: 3,
child: Center(
child: Text(
S.S
.of(context)
.provide_your_current_location,
style: TextStyle(
color: Colors.white,
fontSize: 15,
),
),
),
),
Padding(
padding: const EdgeInsets.only(
right: 15, left: 15),
child: widget
.resultCardConfirmWidget ??
RaisedButton(
elevation: 2,
highlightElevation: 2,
splashColor:
Theme.of(context)
.accentColor,
color: Theme.of(context)
.primaryColor,
colorBrightness:
Brightness.light,
onPressed: () {
_submit();
},
child: Text(S.S
.of(context)
.save)),
)
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
flex: 2,
child: Container(
child: Icon(
Icons.person_pin_circle,
color: Theme.of(context)
.accentColor,
size: 35,
),
),
),
Container(
child: Flexible(
flex: 15,
child: FutureLoadingBuilder<
String>(
future: getAddress(
locationProvider
.lastIdleLocation),
mutable: true,
loadingIndicator: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: <Widget>[
CircularProgressIndicator(),
],
),
builder: (context, address) {
_address = address;
return Text(
address ??
S.S
.of(context)
.unnamed_place,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16),
maxLines: 1,
);
}),
),
),
],
),
),
Visibility(
visible: false,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20),
child: new TextFormField(
enabled: false,
// initialValue: _address.isEmpty ? "" : _address,
onSaved: (input) =>
address.address = input,
),
),
),
Padding(
padding: const EdgeInsets.only(
top: 8.0,
bottom: 8.0,
left: 8.0,
right: 8.0),
child: TextFormField(
keyboardType: TextInputType.text,
onSaved: (input) =>
address.description = input,
validator: (input) => input.length < 3
? S.S
.of(context)
.should_be_more_than_3_letters
: null,
textAlign: TextAlign.center,
decoration: InputDecoration(
labelStyle: TextStyle(
color: Theme.of(context)
.accentColor),
contentPadding: EdgeInsets.all(12),
hintStyle: TextStyle(
color: Theme.of(context)
.focusColor
.withOpacity(0.7)),
prefixIcon: Icon(Icons.streetview,
size: 30,
color: Theme.of(context)
.accentColor),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.focusColor
.withOpacity(0.2))),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.focusColor
.withOpacity(0.5))),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.accentColor
.withOpacity(0.2))),
hintText: S.S.of(context).description,
),
),
),
Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: 8.0),
child: Container(
width: 150,
child: TextFormField(
initialValue: address
.description
?.isNotEmpty ??
false
? address.description
: null,
validator: (input) =>
input.trim().length == 0
? S.S
.of(context)
.should_not_be_empty
: null,
onSaved: (input) =>
address.buildingNo = input,
textAlign: TextAlign.center,
keyboardType:
TextInputType.number,
decoration: InputDecoration(
labelStyle: TextStyle(
color: Theme.of(context)
.accentColor),
contentPadding:
EdgeInsets.all(12),
hintStyle: TextStyle(
color: Theme.of(context)
.focusColor
.withOpacity(0.7)),
prefixIcon: Icon(
Icons.location_city,
size: 30,
color: Theme.of(context)
.accentColor),
border: OutlineInputBorder(
borderSide: BorderSide(
color:
Theme.of(context)
.focusColor
.withOpacity(
0.2))),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(
context)
.focusColor
.withOpacity(
0.5))),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(
context)
.accentColor
.withOpacity(
0.2))),
hintText: S.S
.of(context)
.buildingNo,
),
),
),
),
),
Expanded(
child: Container(
width: 150,
child: TextFormField(
initialValue: address.description
?.isNotEmpty ??
false
? address.description
: null,
onSaved: (input) =>
address.aptNo = input,
validator: (input) =>
input.length == 0
? S.S
.of(context)
.should_not_be_empty
: null,
textAlign: TextAlign.center,
keyboardType:
TextInputType.number,
decoration: InputDecoration(
labelStyle: TextStyle(
color: Theme.of(context)
.accentColor),
contentPadding:
EdgeInsets.all(12),
hintStyle: TextStyle(
color: Theme.of(context)
.focusColor
.withOpacity(0.7)),
prefixIcon: Icon(Icons.domain,
size: 30,
color: Theme.of(context)
.accentColor),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.focusColor
.withOpacity(0.2))),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(
context)
.focusColor
.withOpacity(
0.5))),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(
context)
.accentColor
.withOpacity(
0.2))),
hintText:
S.S.of(context).flatNo,
),
),
),
),
],
),
Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(3.0),
child: SizedBox(
child: CheckboxFormField(
context: context,
initialValue:
address.isDefault ?? false,
onSaved: (input) =>
address.isDefault = input,
title: Text(S.S
.of(context)
.make_default),
),
),
),
),
],
)
],
),
),
],
),
);
}),
),
);
});
},
)
提前致谢