2022-11-01 08:23:06 +01:00
|
|
|
// SPDX-FileCopyrightText: 2022 Iconica
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2023-01-02 15:48:29 +01:00
|
|
|
import 'package:example/media_picker.dart';
|
2022-10-25 14:20:18 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-03-28 10:59:47 +02:00
|
|
|
return MaterialApp(
|
|
|
|
title: 'Media Picker Example',
|
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
2022-10-25 14:20:18 +02:00
|
|
|
),
|
2023-03-28 10:59:47 +02:00
|
|
|
home: const MyHomePage(title: 'Media Picker Example'),
|
2022-10-25 14:20:18 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
|
|
|
|
final String title;
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(widget.title),
|
|
|
|
),
|
2023-01-02 15:48:29 +01:00
|
|
|
body: Center(
|
|
|
|
child: ElevatedButton(
|
2023-01-04 14:35:36 +01:00
|
|
|
child: const Text('Media Picker'),
|
2023-01-02 15:48:29 +01:00
|
|
|
onPressed: () {
|
|
|
|
showModalBottomSheet(
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return MediaPickerExample(
|
|
|
|
callback: () {
|
|
|
|
Navigator.pop(context);
|
2022-10-25 14:20:18 +02:00
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
2023-01-02 15:48:29 +01:00
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2022-10-25 14:20:18 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|