Skip to content

Commit dd68a08

Browse files
committed
init
1 parent 6271caa commit dd68a08

12 files changed

Lines changed: 94 additions & 21 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ migrate_working_dir/
2626
/pubspec.lock
2727
**/doc/api/
2828
.dart_tool/
29+
.packages
2930
build/
31+
#Custom
32+
.devices/

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:flutter_lints/flutter.yaml
1+
include: package:devdf_linter/analysis_options.yaml
22

33
# Additional information about this file can be found at
44
# https://dart.dev/guides/language/analysis-options

android/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
}
1010

1111
dependencies {
12-
classpath("com.android.tools.build:gradle:8.1.0")
12+
classpath("com.android.tools.build:gradle:8.1.4")
1313
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
1414
}
1515
}
@@ -51,7 +51,7 @@ android {
5151

5252
dependencies {
5353
testImplementation("org.jetbrains.kotlin:kotlin-test")
54-
testImplementation("org.mockito:mockito-core:5.0.0")
54+
testImplementation("org.mockito:mockito-core:5.1.0")
5555
}
5656

5757
testOptions {
@@ -66,3 +66,7 @@ android {
6666
}
6767
}
6868
}
69+
70+
dependencies {
71+
implementation 'androidx.documentfile:documentfile:1.0.1'
72+
}
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="devdf.plugins.docman">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="devdf.plugins.docman">
2+
<application>
3+
<provider
4+
android:name="devdf.plugins.docman.DocsProvider"
5+
android:authorities="${applicationId}.plugins.docsProvider"
6+
android:exported="false"
7+
android:grantUriPermissions="true">
8+
<meta-data
9+
android:name="android.support.FILE_PROVIDER_PATHS"
10+
android:resource="@xml/plugins_file_worker_provider_paths"
11+
/>
12+
</provider>
13+
</application>
314
</manifest>

android/src/main/kotlin/devdf/plugins/docman/DocmanPlugin.kt renamed to android/src/main/kotlin/devdf/plugins/docman/DocManPlugin.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package devdf.plugins.docman
22

3-
import androidx.annotation.NonNull
4-
53
import io.flutter.embedding.engine.plugins.FlutterPlugin
64
import io.flutter.plugin.common.MethodCall
75
import io.flutter.plugin.common.MethodChannel
86
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
97
import io.flutter.plugin.common.MethodChannel.Result
108

119
/** DocmanPlugin */
12-
class DocmanPlugin: FlutterPlugin, MethodCallHandler {
10+
class DocManPlugin: FlutterPlugin, MethodCallHandler {
1311
/// The MethodChannel that will the communication between Flutter and native Android
1412
///
1513
/// This local reference serves to register the plugin with the Flutter Engine and unregister it

example/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "8.1.0" apply false
21+
id "com.android.application" version "8.1.4" apply false
2222
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
2323
}
2424

example/test/widget_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
// gestures. You can also use WidgetTester to find child widgets in the widget
66
// tree, read text, and verify that the values of widget properties are correct.
77

8+
import 'package:docman_example/main.dart';
89
import 'package:flutter/material.dart';
910
import 'package:flutter_test/flutter_test.dart';
1011

11-
import 'package:docman_example/main.dart';
12-
1312
void main() {
1413
testWidgets('Verify Platform version', (WidgetTester tester) async {
1514
// Build our app and trigger a frame.
@@ -18,8 +17,7 @@ void main() {
1817
// Verify that platform version is retrieved.
1918
expect(
2019
find.byWidgetPredicate(
21-
(Widget widget) => widget is Text &&
22-
widget.data!.startsWith('Running on:'),
20+
(Widget widget) => widget is Text && widget.data!.startsWith('Running on:'),
2321
),
2422
findsOneWidget,
2523
);

lib/channels/channel_names.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class ChannelName {
2+
/// The main channel name for the plugin.
3+
static const _mainChannel = 'devdf.plugins/docman';
4+
5+
/// The event channel name for the plugin.
6+
static const event = '$_mainChannel/event';
7+
8+
/// The method channel name for the plugin.
9+
static const documentFile = '$_mainChannel/documentfile';
10+
11+
/// The method channel name for the plugin.
12+
static const documentContract = '$_mainChannel/documentcontract';
13+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:docman/channels/document_file_channel.dart';
2+
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
3+
4+
abstract class DocumentFileApi extends PlatformInterface {
5+
/// Constructs a DocumentFileApi platform interface.
6+
DocumentFileApi() : super(token: _token);
7+
8+
static final Object _token = Object();
9+
10+
static DocumentFileChannel _instance = DocumentFileChannel();
11+
12+
/// The default instance of [DocumentFileChannel] to use.
13+
///
14+
/// Defaults to [DocumentFileChannel].
15+
static DocumentFileChannel get instance => _instance;
16+
17+
/// Platform-specific implementations should set this with their own
18+
/// platform-specific class that extends [DocumentFileChannel] when
19+
/// they register themselves.
20+
static set instance(DocumentFileChannel instance) {
21+
PlatformInterface.verifyToken(instance, _token);
22+
_instance = instance;
23+
}
24+
25+
Future<String?> getPlatformVersion() {
26+
throw UnimplementedError('platformVersion() has not been implemented.');
27+
}
28+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'package:docman/channels/channel_names.dart';
2+
import 'package:docman/channels/document_file_api.dart';
3+
import 'package:flutter/foundation.dart';
4+
import 'package:flutter/services.dart';
5+
6+
/// An implementation of [DocumentFileApi] that uses method channels.
7+
class DocumentFileChannel extends DocumentFileApi {
8+
/// The method channel used to interact with the native platform.
9+
@visibleForTesting
10+
final methodChannel = const MethodChannel(ChannelName.documentFile);
11+
12+
@override
13+
Future<String?> getPlatformVersion() async {
14+
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
15+
return version;
16+
}
17+
}

0 commit comments

Comments
 (0)