Skip to content

Commit

Permalink
Fix build issues on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
jochendev committed Mar 18, 2021
1 parent 5f945ea commit c00b85b
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 21 deletions.
3 changes: 3 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package carnegietechnologies.gallery_saver_example

import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
26 changes: 16 additions & 10 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ class _MyAppState extends State<MyApp> {
flex: 1,
child: Container(
child: SizedBox.expand(
child: RaisedButton(
color: Colors.blue,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.blue),
),
onPressed: _takePhoto,
child: Text(firstButtonText,
style: TextStyle(
Expand All @@ -51,8 +53,10 @@ class _MyAppState extends State<MyApp> {
Flexible(
child: Container(
child: SizedBox.expand(
child: RaisedButton(
color: Colors.white,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
),
onPressed: _recordVideo,
child: Text(secondButtonText,
style: TextStyle(
Expand All @@ -69,8 +73,8 @@ class _MyAppState extends State<MyApp> {
}

void _takePhoto() async {
ImagePicker.pickImage(source: ImageSource.camera)
.then((File recordedImage) {
ImagePicker().getImage(source: ImageSource.camera)
.then((PickedFile recordedImage) {
if (recordedImage != null && recordedImage.path != null) {
setState(() {
firstButtonText = 'saving in progress...';
Expand All @@ -86,8 +90,8 @@ class _MyAppState extends State<MyApp> {
}

void _recordVideo() async {
ImagePicker.pickVideo(source: ImageSource.camera)
.then((File recordedVideo) {
ImagePicker().getVideo(source: ImageSource.camera)
.then((PickedFile recordedVideo) {
if (recordedVideo != null && recordedVideo.path != null) {
setState(() {
secondButtonText = 'saving in progress...';
Expand Down Expand Up @@ -142,8 +146,10 @@ class _ScreenshotWidgetState extends State<ScreenshotWidget> {
key: _globalKey,
child: Container(
child: SizedBox.expand(
child: RaisedButton(
color: Colors.pink,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.pink),
),
onPressed: _saveScreenshot,
child: Text(screenshotButtonText,
style: TextStyle(fontSize: textSize, color: Colors.white)),
Expand Down
32 changes: 29 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,17 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
gallery_saver:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -108,7 +113,28 @@ packages:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3+1"
version: "0.7.3"
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.0.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -260,7 +286,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.4"
xdg_directories:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:
sdk: ">=2.1.0 <3.0.0"

dependencies:
image_picker: ^0.6.3+1
image_picker: ^0.7.3
path_provider: ^2.0.1
http: ^0.13.0

Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.4"
xdg_directories:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ homepage: https://github.com/CarnegieTechnologies/gallery_saver

environment:
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.12.0 <2.0.0"

module:
androidX: true
Expand Down

0 comments on commit c00b85b

Please sign in to comment.