在这里提供一个demo
import 'package:flutter/material.dart';
class ColunmWithListPage extends StatelessWidget {
const ColunmWithListPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Colunm嵌套示例'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const FlutterLogo(
size: 80,
),
Stack(
children: [
Opacity(
opacity: 0.0,
child: card(),
),
const SizedBox(
width: double.infinity,
),
Positioned.fill(
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index) {
return card();
},
),
)
],
),
const FlutterLogo(
size: 80,
),
],
),
);
}
Widget card() {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10),
border: const Border(right: BorderSide(color: Colors.white,width: 1.5))
),
child: const Column(
children: [
Text(
'Flutter',
style: TextStyle(fontSize: 35,color: Colors.amber),
),
Text(
'Logo',
style: TextStyle(fontSize: 45,color: Colors.pinkAccent),
),
],
),
);
}
}