Skip to content

Instantly share code, notes, and snippets.

@fkromer
Last active November 13, 2021 18:49
Show Gist options
  • Save fkromer/7208aab1ec9185db5536f10b96d7bc55 to your computer and use it in GitHub Desktop.
Save fkromer/7208aab1ec9185db5536f10b96d7bc55 to your computer and use it in GitHub Desktop.
Basket AlertDialog Example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
final String title;
const MyHomePage({
Key? key,
required this.title,
}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: AlertDialog(
title: Text("Essenskorb von Foodsaver XYZ"),
content: Column(
children: <Widget>[
Image.network(
'https://media.gettyimages.com/photos/germany-cologne-view-of-picnic-basket-picture-id155785604?s=2048x2048',
width: 400.0
),
Padding(
padding: const EdgeInsets.all(7.0),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(7.0),
child: Row(
children: [
Padding(
padding: EdgeInsets.all(7.0),
child: Text('Veröffentlicht am:', style: TextStyle(fontWeight: FontWeight.bold),)
),
Padding(
padding: EdgeInsets.all(7.0),
child: Text('Samstag, 6. Nov. 12:47 Uhr')
),
]
),
),
Padding(
padding: const EdgeInsets.all(7.0),
child: Row(
children: [
Padding(
padding: EdgeInsets.all(7.0),
child: Text('Gültig bis:', style: TextStyle(fontWeight: FontWeight.bold),)
),
Padding(
padding: EdgeInsets.all(7.0),
child: Text('Samstag, 20. Nov. 00:00 Uhr')
),
]
),
),
Padding(
padding: const EdgeInsets.all(7.0),
child: Text('Kaffekapseln für die Nescafé Maschine 3 Pakete MHD 04.21 und 10.21')
)
],
))
],
),
actions: <Widget>[
TextButton(
child: const Text('Zurück zur Karte'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment