gpt4 book ai didi

flutter - 底纸溢出

转载 作者:行者123 更新时间:2023-12-03 03:25:55 24 4
gpt4 key购买 nike

我的底纸有问题。

enter image description here

我有这个溢出错误
这很奇怪。我的意思是,溢出是正常的,这就是小部件的目的:O

https://pub.dev/packages/expandable_bottom_bar

显然,打开底页时不会溢出:

enter image description here

只要我不处于 Release模式,是否应该忽略它?我试图修复它,但没有找到任何方法:/

编辑:底部工作表放在Positioned小部件内的堆栈中:

Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: BottomExpandableAppBar(
// Provide the bar controller in build method or default controller as ancestor in a tree
controller: controller,
appBarHeight: 00.0,
expandedHeight: controller.dragLength,
horizontalMargin: 0.0,
bottomOffset: 50.0,
//expandedBackColor: Colors.white,
expandedDecoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(5.0, 5.0),
blurRadius: 15.0,
spreadRadius: 15.0,
),
]
),
// Your bottom sheet code here
expandedBody: new Bookings(controller: controller),
shape: AutomaticNotchedShape(
RoundedRectangleBorder(),
StadiumBorder(
side: BorderSide()
)
),
// Your bottom app bar code here
),
)

预订小部件是由标题(文本小部件),列表和按钮组成的列。

编辑2:整个屏幕的代码:

import 'package:expandable_bottom_bar/expandable_bottom_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/feather.dart';
//import 'package:travel_agent_app/models/tripList.dart';
import 'package:travel_agent_app/models/Trip.dart';
import 'package:travel_agent_app/screens/appBackground.dart';
import 'package:travel_agent_app/screens/trips/bookings.dart';
import 'package:travel_agent_app/screens/trips/tripContent.dart';


class TripDetails extends StatefulWidget {
final Trip i;
const TripDetails(this.i, {Key key}) : super(key: key);

@override
_TripDetailsState createState() => _TripDetailsState();

}

class _TripDetailsState extends State<TripDetails> with SingleTickerProviderStateMixin {
BottomBarController controller;

@override
void initState() {
super.initState();
controller = BottomBarController(vsync: this, dragLength: 450, snap: true);
}

@override
Widget build(BuildContext context) {

var cardDecoration = BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20.0),
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(0.0, 15.0),
blurRadius: 15.0
),
]
);


var scrollController = ScrollController();

return Scaffold(
extendBody: true,
body: Builder(
builder: (context) =>
Stack(
children: <Widget>[
AppBackground(),

Container(
width: double.infinity,
height: double.infinity,
child: Image.network(
this.widget.i.imageUrl,
fit: BoxFit.fitHeight,
),
),
RotatedBox(
quarterTurns: 3,
child: Container(
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
colors: [Colors.black.withOpacity(0.0), Colors.black.withOpacity(0.5)],
stops: [0.8, 1]
)
),
),
),

Hero(
tag: this.widget.i.origin,
flightShuttleBuilder: (BuildContext flightContext,
Animation<double> animation,
HeroFlightDirection flightDirection,
BuildContext fromHeroContext,
BuildContext toHeroContext,){
return SingleChildScrollView(
child: Container(
child: toHeroContext.widget
),
);
},
child: Material(
type: MaterialType.transparency,
child: Center(
child: SingleChildScrollView(
controller: scrollController,
child: Container(
margin: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.15),
height: MediaQuery.of(context).size.height * 0.87,
width: MediaQuery.of(context).size.width * 0.95,
decoration: cardDecoration,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: new TripContent(this.widget.i, false),
),
),
),
),
),
),

Positioned(
top: 0.0,
left: 0.0,
right: 0.0,
child: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: Icon(Feather.getIconData("arrow-left")),
onPressed: (){
Navigator.pop(context);
},
color: Colors.white,
iconSize: 30.0,
),
),
),

Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: BottomExpandableAppBar(
// Provide the bar controller in build method or default controller as ancestor in a tree
controller: controller,
appBarHeight: 00.0,
expandedHeight: controller.dragLength,
horizontalMargin: 0.0,
bottomOffset: 50.0,
//expandedBackColor: Colors.white,
expandedDecoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(5.0, 5.0),
blurRadius: 15.0,
spreadRadius: 15.0,
),
]
),
// Your bottom sheet code here
expandedBody: new Bookings(controller: controller),
shape: AutomaticNotchedShape(
RoundedRectangleBorder(),
StadiumBorder(
side: BorderSide()
)
),
// Your bottom app bar code here
),
)
],
),
),

);
}
}

最佳答案

我终于解决了这个问题:我意识到溢出来自BottomSheet内部的一个小部件:Column小部件。为了避免这种溢出,我不得不将列包装在ListView小部件中。似乎该列不会溢出,但listview会溢出。

关于flutter - 底纸溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57303323/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com