Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
moverval committed Jan 4, 2024
2 parents 6dc596e + 922cbb6 commit 660d5a6
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 16 deletions.
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# biersommelier
# Biersommelier

A new Flutter project.
Eine App zum notieren von Bieren.

## Getting Started
![Lets get drunk](./lgd.gif)

This project is a starting point for a Flutter application.
## Grund der App

A few resources to get you started if this is your first Flutter project:
Diese App wird während des dritten Semesters an der Fh-Aachen für das SWE Praktikum erstellt.

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
## Anforderungen

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
### Bauen

Die App benötigt [Flutter](https://flutter.dev/) sowie die Android SDK mit Mindestversion 33. Um diese komfotabel zu installieren kann [Android Studio](https://developer.android.com/studio) verwendet werden.

### Mobil

Die App benötigt eine Android Version von 11 oder höher oder die iOS Version 16 oder höher.

## Bauen der App

Die App kann auf Windows, Linux sowie Mac gebaut werden. Um eine Apk zu erstellen kann dieser Befehl genutzt werden

```bash
flutter build apk
```
Binary file added lgd.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/components/ImagePicker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ImagePicker extends StatefulWidget {
class _ImagePickerState extends State<ImagePicker> {
Future getImage() async {
try {
final pickedFile = await ImageManager.pickImage();
final pickedFile = await ImageManager.pickImage(context);

final _i = File(pickedFile.path);
if (_i.lengthSync() > 50 * 1024 * 1024) {
Expand Down
8 changes: 6 additions & 2 deletions lib/components/Popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ class Popup extends StatelessWidget {
),
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 15, horizontal: 30),
const EdgeInsets.symmetric(vertical: 15),
child: Material(
color: Colors.transparent,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
description != null
? Padding(
padding: const EdgeInsets.only(bottom: 10),
padding: const EdgeInsets.fromLTRB(30, 0, 10, 30),
child: Text(
description!,
style: const TextStyle(fontSize: 20),
Expand All @@ -149,6 +149,10 @@ class Popup extends StatelessWidget {
for (Option option in options) {
list.add(
TextButton.icon(
style: TextButton.styleFrom(
foregroundColor: option.color,
padding: const EdgeInsets.symmetric(horizontal: 30),
),
onPressed: option.callback,
icon: Image.asset(
option.icon,
Expand Down
43 changes: 40 additions & 3 deletions lib/imagemanager/ImageManager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,47 @@ class ImageManager {
}
}

/// Opens the image picker and returns the picked image
static Future<File> pickImage() async {
static Future<File> pickImage(BuildContext context) async {
final ImagePicker picker = ImagePicker();
final XFile? image = await picker.pickImage(source: ImageSource.gallery);
// Show dialog to ask user for source type
final ImageSource? source = await showDialog<ImageSource>(
context: context,
builder: (BuildContext context) => SimpleDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
title: const Text('Quelle auswählen'),
children: <Widget>[
SimpleDialogOption(
child: const Row(
children: [
Icon(Icons.camera),
SizedBox(width: 16), // Add space between icon and text
Text('Kamera'),
],
),
onPressed: () => Navigator.of(context).pop(ImageSource.camera),
),
SimpleDialogOption(
child: const Row(
children: [
Icon(Icons.photo_library),
SizedBox(width: 16), // Add space between icon and text
Text('Gallerie'),
],
),
onPressed: () => Navigator.of(context).pop(ImageSource.gallery),
),
],
),
);

if (source == null) {
// User cancelled the dialog
throw Exception('No image selected');
}

final XFile? image = await picker.pickImage(source: source);
if (image != null) {
return File(image.path);
} else {
Expand Down

0 comments on commit 660d5a6

Please sign in to comment.