40 lines
1.3 KiB
Dart
40 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
|
|
|
|
part 'scan_screen.g.dart';
|
|
|
|
@riverpod
|
|
Future<String> _scanDocument(Ref ref) async {
|
|
var configuration = DocumentScanningFlow(
|
|
appearance: DocumentFlowAppearanceConfiguration(
|
|
statusBarMode: StatusBarMode.DARK,
|
|
),
|
|
cleanScanningSession: true,
|
|
outputSettings: DocumentScannerOutputSettings(pagesScanLimit: 1),
|
|
screens: DocumentScannerScreens(
|
|
review: ReviewScreenConfiguration(enabled: false),
|
|
),
|
|
);
|
|
var documentResult = await ScanbotSdkUiV2.startDocumentScanner(configuration);
|
|
print("@@@");
|
|
print(documentResult);
|
|
print("####");
|
|
|
|
return "changeme";
|
|
}
|
|
|
|
class ScanScreen extends HookConsumerWidget {
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final boredSuggestion = ref.watch(_scanDocumentProvider);
|
|
// Perform a switch-case on the result to handle loading/error states
|
|
return switch (boredSuggestion) {
|
|
AsyncData(:final value) => Text('data: $value'),
|
|
AsyncError(:final error) => Text('error: $error'),
|
|
_ => const Center(child: CircularProgressIndicator()),
|
|
};
|
|
}
|
|
}
|