Skip to content

Instantly share code, notes, and snippets.

@gspencergoog
Last active August 10, 2022 16:11
Show Gist options
  • Select an option

  • Save gspencergoog/cd948297c46ef2bcd44bcc326801eb62 to your computer and use it in GitHub Desktop.

Select an option

Save gspencergoog/cd948297c46ef2bcd44bcc326801eb62 to your computer and use it in GitHub Desktop.
Layout Problem
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