滚动视图之外的滚动效果?颤振网
Scrolling effect outside of scrolling view? Flutter Web
即使光标位于行的右侧,我也希望能够滚动。
并且可能像往常一样在最右边有滚动条。
我怎样才能得到这个效果?
可能是底部溢出的问题。是否应该有两个滚动部分?
这是我目前拥有的
class CucinaGardaView extends StatelessWidget {
const CucinaGardaView({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
flex: 1,
child: SingleChildScrollView(
child: Column(
children: [
Image.network(
'https://images.unsplash.com/photo-1601628828688-632f38a5a7d0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1009&q=80',
fit: BoxFit.cover,
),
Image.network(
'https://images.unsplash.com/photo-1554995207-c18c203602cb?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80',
fit: BoxFit.cover,
),
Image.network(
'https://images.unsplash.com/photo-1600210492493-0946911123ea?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1074&q=80',
fit: BoxFit.cover,
),
],
),
),
),
Expanded(
flex: 1,
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
CustomTextWidget(
text: 'Just a Title',
style: textHeadingThree,
),
SizedBox(
height: 20.0,
),
CustomParagraphWidget(
text: [
TextSpan(
children: [
TextSpan(
text:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit,',
style: textText,
),
TextSpan(
text:
' sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
style: textText,
),
TextSpan(
text:
' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris',
style: textText,
),
TextSpan(
text: ' nisi ut aliquip ex ea commodo consequat.',
style: textText,
),
],
),
],
),
],
),
),
),
),
],
);
}
}
有人能给我指出正确的方向吗?
谢谢
你可以尝试使用 Stack with Positioned
DartPad sample。这不是最干净的解决方案,但作为起点就可以了
即使光标位于行的右侧,我也希望能够滚动。 并且可能像往常一样在最右边有滚动条。 我怎样才能得到这个效果?
可能是底部溢出的问题。是否应该有两个滚动部分?
这是我目前拥有的
class CucinaGardaView extends StatelessWidget {
const CucinaGardaView({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
flex: 1,
child: SingleChildScrollView(
child: Column(
children: [
Image.network(
'https://images.unsplash.com/photo-1601628828688-632f38a5a7d0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1009&q=80',
fit: BoxFit.cover,
),
Image.network(
'https://images.unsplash.com/photo-1554995207-c18c203602cb?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80',
fit: BoxFit.cover,
),
Image.network(
'https://images.unsplash.com/photo-1600210492493-0946911123ea?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1074&q=80',
fit: BoxFit.cover,
),
],
),
),
),
Expanded(
flex: 1,
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
CustomTextWidget(
text: 'Just a Title',
style: textHeadingThree,
),
SizedBox(
height: 20.0,
),
CustomParagraphWidget(
text: [
TextSpan(
children: [
TextSpan(
text:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit,',
style: textText,
),
TextSpan(
text:
' sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
style: textText,
),
TextSpan(
text:
' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris',
style: textText,
),
TextSpan(
text: ' nisi ut aliquip ex ea commodo consequat.',
style: textText,
),
],
),
],
),
],
),
),
),
),
],
);
}
}
有人能给我指出正确的方向吗? 谢谢
你可以尝试使用 Stack with Positioned
DartPad sample。这不是最干净的解决方案,但作为起点就可以了