Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:label="storage_path_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:name="io.flutter.embedding.android.FlutterActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
Expand All @@ -27,13 +27,24 @@
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package com.follow2vivek.storagepathexample;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
5 changes: 5 additions & 0 deletions example/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>


<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources>
1 change: 1 addition & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
19 changes: 12 additions & 7 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:storage_path/storage_path.dart';
import 'package:storage_path_example/file_model.dart';
Expand All @@ -15,6 +16,7 @@ class MyApp extends StatefulWidget {

class _MyAppState extends State<MyApp> {
String imagePath = "";

@override
void initState() {
super.initState();
Expand All @@ -30,7 +32,7 @@ class _MyAppState extends State<MyApp> {
print(response);
var imageList = response as List;
List<FileModel> list =
imageList.map<FileModel>((json) => FileModel.fromJson(json)).toList();
imageList.map<FileModel>((json) => FileModel.fromJson(json)).toList();

setState(() {
imagePath = list[11].files[0];
Expand All @@ -52,7 +54,8 @@ class _MyAppState extends State<MyApp> {
}
return videoPath;
}
Future<void> getAudioPath() async {

Future<void> getAudioPath() async {
String audioPath = "";
try {
audioPath = await StoragePath.audioPath;
Expand All @@ -63,7 +66,8 @@ class _MyAppState extends State<MyApp> {
}
return audioPath;
}
Future<void> getFilePath() async {

Future<void> getFilePath() async {
String filePath = "";
try {
filePath = await StoragePath.filePath;
Expand All @@ -74,6 +78,7 @@ class _MyAppState extends State<MyApp> {
}
return filePath;
}

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -87,9 +92,9 @@ class _MyAppState extends State<MyApp> {
height: 200,
child: imagePath != ""
? Image.file(
File(imagePath),
fit: BoxFit.contain,
)
File(imagePath),
fit: BoxFit.contain,
)
: Container(),
),
),
Expand Down