import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('CustomScrollView'),
),
body: CustomScrollView( // ⇦ ここ
slivers: [
SliverToBoxAdapter(
child: Column(
children: [
Container(
height: 200,
color: Colors.blue,
),
Container(height: 100, color: Colors.cyan)
],
),
),
SliverFillRemaining( // ⇦ ここ
hasScrollBody: false, // ⇦ ここ
child: Column(
children: [
const Spacer(), // ⇦ ここ
Container(
width: double.infinity,
child: const Center(child: Text("This is Footer")),
decoration: BoxDecoration(
border: Border.all(color: Colors.black26, width: 1),
),
)
],
),
)
],
),
);
}
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00