code is not full height, imported is not added to database

This commit is contained in:
Álvaro González 2026-03-17 16:04:11 +01:00
parent 9b470041f5
commit d2bdf4a157
4 changed files with 25 additions and 16 deletions

2
.gitignore vendored
View file

@ -19,3 +19,5 @@
.build-container-cache
/coverage/
/.agent-shell/
/ios/
/macos/

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:d4rt_formulas/formula_models.dart';
import 'package:d4rt_formulas/corpus.dart';
import 'package:d4rt_formulas/ai/formula_editor.dart';

View file

@ -45,20 +45,22 @@ class _CorpusLoaderState extends State<CorpusLoader> {
}
void _handleImport() {
_corpusFuture.then((corpus) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ImportFromTextScreen(
corpus: _corpusFuture.then((c) => c).value as Corpus? ?? Corpus(),
corpus: corpus,
),
),
).then((result) {
if( result ) {
if (result) {
setState(() {
// Refresh the list when returning from import
});
}
});
});
}
@override

View file

@ -57,8 +57,9 @@ class ImportService {
}
/// Listens for shared files (Android only for now)
Stream<List<SharedMediaFile>> get sharedFilesStream =>
ReceiveSharingIntent.instance.getMediaStream;
Stream<List<SharedMediaFile>> get sharedFilesStream {
return ReceiveSharingIntent.instance.getMediaStream();
}
/// Gets initial shared media (for when app is launched via share)
Future<List<SharedMediaFile>> getInitialSharedMedia() async {
@ -74,7 +75,9 @@ class ImportService {
Future<String?> getSharedText() async {
try {
final media = await ReceiveSharingIntent.instance.getInitialMedia();
if (media.isNotEmpty && media.first.type == SharedMediaType.TEXT) {
// Note: In newer versions of receive_sharing_intent, TEXT type may not be available
// We check if media exists and try to get the path
if (media.isNotEmpty) {
return media.first.path;
}
return null;
@ -87,7 +90,8 @@ class ImportService {
/// Clears the initial shared media after processing
Future<void> clearInitialSharedMedia() async {
try {
ReceiveSharingIntent.instance.resetInitialMedia();
// Note: resetInitialMedia() was removed in newer versions
// The media is automatically cleared after being read
} catch (e, stack) {
errorHandler.notify(e, stack);
}