diff --git a/android/app/build.gradle b/android/app/build.gradle
index 30d91864..58146be7 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -68,7 +68,7 @@ android {
defaultConfig {
// Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "de.wger.flutter"
- minSdkVersion 16
+ minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index 8beca717..b9f6041f 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -10,6 +10,9 @@
+
+
+
diff --git a/lib/main.dart b/lib/main.dart
index 4f93faa6..17d672b0 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -40,6 +40,10 @@ import 'package:wger/theme/theme.dart';
import 'providers/auth.dart';
void main() {
+ // Needs to be called before runApp
+ WidgetsFlutterBinding.ensureInitialized();
+
+ // Application
runApp(MyApp());
}
diff --git a/lib/screens/gallery_screen.dart b/lib/screens/gallery_screen.dart
index 449eb369..f4e5f116 100644
--- a/lib/screens/gallery_screen.dart
+++ b/lib/screens/gallery_screen.dart
@@ -19,19 +19,45 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
+import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
-import 'package:wger/models/workouts/workout_plan.dart';
import 'package:wger/providers/workout_plans.dart';
-import 'package:wger/screens/form_screen.dart';
import 'package:wger/widgets/app_drawer.dart';
import 'package:wger/widgets/core/core.dart';
import 'package:wger/widgets/gallery/overview.dart';
-import 'package:wger/widgets/workouts/forms.dart';
-class GalleryScreen extends StatelessWidget {
+class GalleryScreen extends StatefulWidget {
static const routeName = '/gallery';
+
const GalleryScreen();
+ @override
+ _GalleryScreenState createState() => _GalleryScreenState();
+}
+
+class _GalleryScreenState extends State {
+ PickedFile? _file;
+
+ void _showPhotoLibrary() async {
+ final picker = ImagePicker();
+ final file = await picker.getImage(source: ImageSource.gallery);
+
+ print(file);
+ setState(() {
+ _file = file!;
+ });
+ }
+
+ void _showCamera(BuildContext context) async {
+ final picker = ImagePicker();
+ final file = await picker.getImage(source: ImageSource.camera);
+
+ print(_file);
+ setState(() {
+ _file = file;
+ });
+ }
+
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -40,15 +66,35 @@ class GalleryScreen extends StatelessWidget {
),
drawer: AppDrawer(),
floatingActionButton: FloatingActionButton(
- child: const Icon(Icons.add),
- onPressed: () {
- Navigator.pushNamed(
- context,
- FormScreen.routeName,
- arguments: FormScreenArguments(
- AppLocalizations.of(context)!.newWorkout,
- WorkoutForm(WorkoutPlan.empty()),
- ),
+ child: Icon(Icons.camera_alt),
+ // Provide an onPressed callback.
+ onPressed: () async {
+ showModalBottomSheet(
+ context: context,
+ builder: (context) {
+ return Container(
+ height: 150,
+ child: Column(
+ children: [
+ ListTile(
+ onTap: () {
+ Navigator.of(context).pop();
+ _showCamera(context);
+ },
+ leading: Icon(Icons.photo_camera),
+ title: Text("Take a picture"),
+ ),
+ ListTile(
+ onTap: () {
+ Navigator.of(context).pop();
+ _showPhotoLibrary();
+ },
+ leading: Icon(Icons.photo_library),
+ title: Text("Choose from photo library"))
+ ],
+ ),
+ );
+ },
);
},
),
diff --git a/pubspec.lock b/pubspec.lock
index 8f502f8f..6d72eb11 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -84,7 +84,7 @@ packages:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.2"
build_runner_core:
dependency: transitive
description:
@@ -105,7 +105,21 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
- version: "8.0.5"
+ version: "8.0.6"
+ camera:
+ dependency: "direct main"
+ description:
+ name: camera
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.8.1"
+ camera_platform_interface:
+ dependency: transitive
+ description:
+ name: camera_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.1"
characters:
dependency: transitive
description:
@@ -147,14 +161,14 @@ packages:
name: chewie
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.2"
+ version: "1.0.0"
chewie_audio:
dependency: transitive
description:
name: chewie_audio
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.2"
+ version: "1.2.0"
cli_util:
dependency: transitive
description:
@@ -190,6 +204,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
+ cross_file:
+ dependency: transitive
+ description:
+ name: cross_file
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.3.1+1"
crypto:
dependency: transitive
description:
@@ -197,27 +218,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
- css_colors:
- dependency: transitive
- description:
- name: css_colors
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.0"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
- version: "0.16.2"
+ version: "0.17.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.2"
+ version: "1.0.3"
dart_style:
dependency: transitive
description:
@@ -271,7 +285,7 @@ packages:
name: flutter_html
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "2.0.0-nullsafety.1"
flutter_keyboard_visibility:
dependency: transitive
description:
@@ -306,19 +320,33 @@ packages:
name: flutter_layout_grid
url: "https://pub.dartlang.org"
source: hosted
- version: "0.10.5"
+ version: "1.0.1"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
+ flutter_math_fork:
+ dependency: transitive
+ description:
+ name: flutter_math_fork
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.3.2+1"
+ flutter_plugin_android_lifecycle:
+ dependency: transitive
+ description:
+ name: flutter_plugin_android_lifecycle
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.1"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
- version: "0.20.0-nullsafety.3"
+ version: "0.22.0"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -330,12 +358,19 @@ packages:
name: flutter_typeahead
url: "https://pub.dartlang.org"
source: hosted
- version: "3.1.1"
+ version: "3.1.2"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
+ frontend_server_client:
+ dependency: transitive
+ description:
+ name: frontend_server_client
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.0"
glob:
dependency: transitive
description:
@@ -356,14 +391,14 @@ packages:
name: html
url: "https://pub.dartlang.org"
source: hosted
- version: "0.14.0+4"
+ version: "0.15.0"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.13.2"
+ version: "0.13.3"
http_multi_server:
dependency: transitive
description:
@@ -385,13 +420,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
- import_js_library:
- dependency: transitive
+ image_picker:
+ dependency: "direct main"
description:
- name: import_js_library
+ name: image_picker
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.2"
+ version: "0.7.4"
+ image_picker_for_web:
+ dependency: transitive
+ description:
+ name: image_picker_for_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.0"
+ image_picker_platform_interface:
+ dependency: transitive
+ description:
+ name: image_picker_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.0"
intl:
dependency: "direct main"
description:
@@ -496,14 +545,14 @@ packages:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
- version: "0.5.0"
+ version: "0.5.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.0"
+ version: "0.2.1"
path_provider_linux:
dependency: transitive
description:
@@ -594,7 +643,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.5"
+ version: "3.0.1"
shared_preferences:
dependency: "direct main"
description:
@@ -733,6 +782,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
+ tuple:
+ dependency: transitive
+ description:
+ name: tuple
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.0"
typed_data:
dependency: transitive
description:
@@ -795,42 +851,49 @@ packages:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "2.1.1"
video_player_platform_interface:
dependency: transitive
description:
name: video_player_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "2.2.0"
+ version: "4.1.0"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4+1"
+ version: "2.0.0"
wakelock:
dependency: transitive
description:
name: wakelock
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.1+1"
+ version: "0.4.0"
+ wakelock_macos:
+ dependency: transitive
+ description:
+ name: wakelock_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.0"
wakelock_platform_interface:
dependency: transitive
description:
name: wakelock_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.0+1"
+ version: "0.2.0"
wakelock_web:
dependency: transitive
description:
name: wakelock_web
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.0+3"
+ version: "0.2.0"
watcher:
dependency: transitive
description:
@@ -844,14 +907,14 @@ packages:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0"
webview_flutter:
dependency: transitive
description:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.7"
+ version: "2.0.4"
win32:
dependency: transitive
description:
@@ -882,4 +945,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
- flutter: ">=1.24.0-7.0"
+ flutter: ">=2.0.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 13ca8fd7..582b4645 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -36,7 +36,7 @@ dependencies:
collection: ^1.15.0-nullsafety.4
cupertino_icons: ^1.0.0
flutter_calendar_carousel: ^2.0.1
- flutter_html: ^1.3.0
+ flutter_html: ^2.0.0-nullsafety.1
flutter_typeahead: ^3.1.1
http: ^0.13.2
intl: ^0.17.0
@@ -46,6 +46,10 @@ dependencies:
shared_preferences: ^2.0.5
table_calendar: ^3.0.0
url_launcher: ^6.0.2
+ camera: ^0.8.1
+ #path_provider: ^2.0.1
+ #path: ^1.8.0
+ image_picker: ^0.7.4
dev_dependencies:
flutter_test: