forked from firka/student-legacy
images are now removable
This commit is contained in:
parent
c9db496e59
commit
f64b1360d9
@ -149,7 +149,11 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
|
|||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => NoteViewScreen(note: e))),
|
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,
|
height: MediaQuery.of(context).size.width / 2.42,
|
||||||
width: MediaQuery.of(context).size.width / 2.42,
|
width: MediaQuery.of(context).size.width / 2.42,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -172,6 +176,7 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:refilc/api/providers/self_note_provider.dart';
|
import 'package:refilc/api/providers/self_note_provider.dart';
|
||||||
import 'package:refilc/models/self_note.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:flutter_feather_icons/flutter_feather_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:markdown/markdown.dart' as md;
|
import 'package:markdown/markdown.dart' as md;
|
||||||
|
import 'notes_screen.i18n.dart';
|
||||||
|
|
||||||
class NoteViewScreen extends StatefulWidget {
|
class NoteViewScreen extends StatefulWidget {
|
||||||
const NoteViewScreen({super.key, required this.note});
|
const NoteViewScreen({super.key, required this.note});
|
||||||
@ -30,7 +33,9 @@ class NoteViewScreenState extends State<NoteViewScreen> {
|
|||||||
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
|
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
leading: BackButton(color: AppColors.of(context).text),
|
leading: BackButton(color: AppColors.of(context).text),
|
||||||
title: 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(
|
style: TextStyle(
|
||||||
color: AppColors.of(context).text,
|
color: AppColors.of(context).text,
|
||||||
fontSize: 26.0,
|
fontSize: 26.0,
|
||||||
@ -38,6 +43,7 @@ class NoteViewScreenState extends State<NoteViewScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
if (widget.note.noteType == NoteType.text)
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(10.1),
|
borderRadius: BorderRadius.circular(10.1),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -49,7 +55,8 @@ class NoteViewScreenState extends State<NoteViewScreen> {
|
|||||||
AddNoteScreen(initialNote: widget.note)));
|
AddNoteScreen(initialNote: widget.note)));
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).colorScheme.secondary.withOpacity(0.2),
|
color:
|
||||||
|
Theme.of(context).colorScheme.secondary.withOpacity(0.2),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@ -81,6 +88,7 @@ class NoteViewScreenState extends State<NoteViewScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (widget.note.noteType == NoteType.text)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
@ -140,7 +148,8 @@ class NoteViewScreenState extends State<NoteViewScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: MarkdownBody(
|
child: widget.note.noteType == NoteType.text
|
||||||
|
? MarkdownBody(
|
||||||
data: widget.note.content,
|
data: widget.note.content,
|
||||||
extensionSet: md.ExtensionSet(
|
extensionSet: md.ExtensionSet(
|
||||||
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
||||||
@ -154,6 +163,14 @@ class NoteViewScreenState extends State<NoteViewScreen> {
|
|||||||
fontSize: 15.0,
|
fontSize: 15.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
child: Image.memory(
|
||||||
|
const Base64Decoder().convert(widget.note.content),
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
gaplessPlayback: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Expanded(
|
// Expanded(
|
||||||
|
@ -18,6 +18,7 @@ extension SettingsLocalization on String {
|
|||||||
"click_here": "Click here",
|
"click_here": "Click here",
|
||||||
"select_image": "to select an image",
|
"select_image": "to select an image",
|
||||||
"new_image": "New Image",
|
"new_image": "New Image",
|
||||||
|
"image_note": "Image",
|
||||||
},
|
},
|
||||||
"hu_hu": {
|
"hu_hu": {
|
||||||
"notes": "Füzet",
|
"notes": "Füzet",
|
||||||
@ -34,6 +35,7 @@ extension SettingsLocalization on String {
|
|||||||
"click_here": "Kattints ide",
|
"click_here": "Kattints ide",
|
||||||
"select_image": "kép kiválasztásához",
|
"select_image": "kép kiválasztásához",
|
||||||
"new_image": "Új kép",
|
"new_image": "Új kép",
|
||||||
|
"image_note": "Kép",
|
||||||
},
|
},
|
||||||
"de_de": {
|
"de_de": {
|
||||||
"notes": "Broschüre",
|
"notes": "Broschüre",
|
||||||
@ -50,6 +52,7 @@ extension SettingsLocalization on String {
|
|||||||
"click_here": "Klicken Sie hier",
|
"click_here": "Klicken Sie hier",
|
||||||
"select_image": "um ein Bild auszuwählen",
|
"select_image": "um ein Bild auszuwählen",
|
||||||
"new_image": "Neues Bild",
|
"new_image": "Neues Bild",
|
||||||
|
"image_note": "Bild",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user