Skip to content

Instantly share code, notes, and snippets.

@andrea689
Created April 5, 2019 16:11
Show Gist options
  • Save andrea689/9b19d4285cd49b946936a12aaf5f76ba to your computer and use it in GitHub Desktop.
Save andrea689/9b19d4285cd49b946936a12aaf5f76ba to your computer and use it in GitHub Desktop.
[ios][bug] BottomSheet with image
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey();
void _showBottomSheet() {
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
return new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
"assets/flutter.png",
),
],
);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text(widget.title),
),
backgroundColor: Colors.red,
body: RaisedButton(
onPressed: _showBottomSheet,
child: Text('Show BottomSheet'),
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment