Skip to content

Instantly share code, notes, and snippets.

@daohoangson
Created November 12, 2020 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daohoangson/13bcc1d7af6b734fc967ed3a224e69bb to your computer and use it in GitHub Desktop.
Save daohoangson/13bcc1d7af6b734fc967ed3a224e69bb to your computer and use it in GitHub Desktop.
Button over bottomsheet-like layout
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.grey,
child: SizedBox.expand(
child: Column(
children: [
Flexible(
child: Center(child: Text('Above')),
flex: 1,
),
Flexible(
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
color: Colors.white,
child: Center(
child: Text(
'Below',
style: TextStyle(color: Colors.black),
),
),
),
Positioned(
right: 20,
top: -20,
child: Container(
color: Colors.green,
height: 40,
width: 40,
),
),
],
),
flex: 2,
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment