images are now removable

This commit is contained in:
Kima 2024-05-05 21:53:39 +02:00
parent c9db496e59
commit f64b1360d9
3 changed files with 101 additions and 76 deletions

View File

@ -149,7 +149,11 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
CupertinoPageRoute(
builder: (context) => NoteViewScreen(note: e))),
)
: Container(
: GestureDetector(
onTap: () => Navigator.of(context, rootNavigator: true).push(
CupertinoPageRoute(
builder: (context) => NoteViewScreen(note: e))),
child: Container(
height: MediaQuery.of(context).size.width / 2.42,
width: MediaQuery.of(context).size.width / 2.42,
decoration: BoxDecoration(
@ -172,6 +176,7 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
),
),
),
),
));
}

View File

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:refilc/api/providers/self_note_provider.dart';
import 'package:refilc/models/self_note.dart';
@ -8,6 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart';
import 'package:markdown/markdown.dart' as md;
import 'notes_screen.i18n.dart';
class NoteViewScreen extends StatefulWidget {
const NoteViewScreen({super.key, required this.note});
@ -30,7 +33,9 @@ class NoteViewScreenState extends State<NoteViewScreen> {
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
leading: BackButton(color: AppColors.of(context).text),
title: Text(
widget.note.title ?? '${widget.note.content.split(' ')[0]}...',
widget.note.noteType == NoteType.text
? (widget.note.title ?? '${widget.note.content.split(' ')[0]}...')
: 'image_note'.i18n,
style: TextStyle(
color: AppColors.of(context).text,
fontSize: 26.0,
@ -38,6 +43,7 @@ class NoteViewScreenState extends State<NoteViewScreen> {
),
),
actions: [
if (widget.note.noteType == NoteType.text)
ClipRRect(
borderRadius: BorderRadius.circular(10.1),
child: GestureDetector(
@ -49,7 +55,8 @@ class NoteViewScreenState extends State<NoteViewScreen> {
AddNoteScreen(initialNote: widget.note)));
},
child: Container(
color: Theme.of(context).colorScheme.secondary.withOpacity(0.2),
color:
Theme.of(context).colorScheme.secondary.withOpacity(0.2),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Stack(
@ -81,6 +88,7 @@ class NoteViewScreenState extends State<NoteViewScreen> {
),
),
),
if (widget.note.noteType == NoteType.text)
const SizedBox(
width: 10,
),
@ -140,7 +148,8 @@ class NoteViewScreenState extends State<NoteViewScreen> {
child: Column(
children: [
Expanded(
child: MarkdownBody(
child: widget.note.noteType == NoteType.text
? MarkdownBody(
data: widget.note.content,
extensionSet: md.ExtensionSet(
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
@ -154,6 +163,14 @@ class NoteViewScreenState extends State<NoteViewScreen> {
fontSize: 15.0,
),
),
)
: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Image.memory(
const Base64Decoder().convert(widget.note.content),
fit: BoxFit.contain,
gaplessPlayback: true,
),
),
),
// Expanded(

View File

@ -18,6 +18,7 @@ extension SettingsLocalization on String {
"click_here": "Click here",
"select_image": "to select an image",
"new_image": "New Image",
"image_note": "Image",
},
"hu_hu": {
"notes": "Füzet",
@ -34,6 +35,7 @@ extension SettingsLocalization on String {
"click_here": "Kattints ide",
"select_image": "kép kiválasztásához",
"new_image": "Új kép",
"image_note": "Kép",
},
"de_de": {
"notes": "Broschüre",
@ -50,6 +52,7 @@ extension SettingsLocalization on String {
"click_here": "Klicken Sie hier",
"select_image": "um ein Bild auszuwählen",
"new_image": "Neues Bild",
"image_note": "Bild",
},
};