Skip to content

Instantly share code, notes, and snippets.

@hasanzia1993
Created March 30, 2020 06:37
Show Gist options
  • Save hasanzia1993/d76eae7a6490694aae6880c19206b8f8 to your computer and use it in GitHub Desktop.
Save hasanzia1993/d76eae7a6490694aae6880c19206b8f8 to your computer and use it in GitHub Desktop.
Flutter Iphone X bottom notch padding fix for fixed bottom button
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.purple,
),
home: MyHomePage(title: 'Iphone X'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: ListView.builder(
itemBuilder: (context, index) {
return CheckboxListTile(
onChanged: (item) => null,
value: index % 2 == 0,
title: Text('Item $index'),
);
},
itemCount: 25,
),
),
FlatButton(
onPressed: () => null,
color: Colors.amber,
child: SafeArea(
child: Container(
alignment: Alignment.center,
height: 60,
child: Text('SAVE'),
),
),
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment