Created
February 13, 2022 22:46
-
-
Save pingbird/94dc9d5f3f16a933e18ae84dbaa8c3af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Boxy Demo', | |
theme: ThemeData.dark(), | |
home: Scaffold(body: const MyHomePage()), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
const MyHomePage({Key? key}) : super(key: key); | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return CustomScrollView( | |
slivers: [ | |
SliverList( | |
delegate: SliverChildListDelegate([ | |
Container( | |
color: Colors.red, | |
child: Text('a' * 500), | |
padding: const EdgeInsets.all(16.0), | |
), | |
Container( | |
color: Colors.green, | |
child: Text('a' * 500), | |
padding: const EdgeInsets.all(16.0), | |
), | |
Container( | |
color: Colors.blue, | |
child: Text('a' * 500), | |
padding: const EdgeInsets.all(16.0), | |
), | |
Container( | |
color: Colors.amber, | |
child: Text('a' * 500), | |
padding: const EdgeInsets.all(16.0), | |
), | |
]), | |
), | |
SliverFillRemaining( | |
hasScrollBody: false, | |
child: Center( | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: ElevatedButton( | |
child: const Text('A button'), | |
onPressed: () {}, | |
), | |
), | |
), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment