Last active
August 10, 2022 16:11
-
-
Save gspencergoog/cd948297c46ef2bcd44bcc326801eb62 to your computer and use it in GitHub Desktop.
Layout Problem
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(MaterialApp( | |
| home: Scaffold( | |
| body: Sample( | |
| children: <Widget>[ | |
| ElevatedButton( | |
| onPressed: () {}, | |
| child: const Text('Button 1'), | |
| ), | |
| ElevatedButton( | |
| onPressed: () {}, | |
| child: const Text('Button 2'), | |
| ), | |
| ElevatedButton( | |
| onPressed: () {}, | |
| child: const Text('Button 3'), | |
| ), | |
| ], | |
| ), | |
| ), | |
| )); | |
| } | |
| class Sample extends StatefulWidget { | |
| const Sample({super.key, required this.children}); | |
| final List<Widget> children; | |
| @override | |
| State<Sample> createState() => _SampleState(); | |
| } | |
| class _SampleState extends State<Sample> { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Column( | |
| children: <Widget>[ | |
| SizedBox( | |
| height: 48, | |
| child: CustomScrollView( | |
| scrollDirection: Axis.horizontal, | |
| slivers: <Widget>[ | |
| SliverList( | |
| delegate: SliverChildListDelegate( | |
| widget.children, | |
| ), | |
| ), | |
| const SliverFillRemaining(hasScrollBody: false, child: Placeholder()), | |
| ], | |
| ), | |
| ), | |
| const Expanded(child: Placeholder()), | |
| ], | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment