我有一个 CustomScrollView 包含一个 SliverToBoxAdapter。我给的宽度为MediaQuery.of(context).size.width / 1.75。但它需要屏幕的全宽度。
在此输入图像描述。如果容器放置在 Customscrollview 之外,则容器的宽度有效。
class ProfileView extends GetView<ProfileController> {
const ProfileView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Row(children: [
Expanded(
child: CustomScrollView(
shrinkWrap: true,
slivers: [
SliverToBoxAdapter(
child: Padding(
padding:
const EdgeInsets.only(top: 40.0, left: 45),
child: Container(
padding: EdgeInsets.only(top: 30),
width: MediaQuery.of(context).size.width / 1.75,
decoration: BoxDecoration(
border:
Border.all(color: Colors.red, width: 0.7),
color: Color(0xfffbfbfa),
),
child: Stack(
children: [
Positioned(
right: 0,
top: 0,
child: …Run Code Online (Sandbox Code Playgroud)