changed everything from filcnaplo to refilc finally
This commit is contained in:
186
refilc_mobile_ui/lib/screens/notes/add_note_screen.dart
Normal file
186
refilc_mobile_ui/lib/screens/notes/add_note_screen.dart
Normal file
@@ -0,0 +1,186 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:refilc/api/providers/database_provider.dart';
|
||||
import 'package:refilc/api/providers/self_note_provider.dart';
|
||||
import 'package:refilc/api/providers/user_provider.dart';
|
||||
import 'package:refilc/models/self_note.dart';
|
||||
import 'package:refilc/theme/colors/colors.dart';
|
||||
import 'package:refilc_kreta_api/providers/homework_provider.dart';
|
||||
import 'package:refilc_mobile_ui/screens/notes/notes_screen.i18n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class AddNoteScreen extends StatefulWidget {
|
||||
const AddNoteScreen({super.key, this.initialNote});
|
||||
|
||||
final SelfNote? initialNote;
|
||||
|
||||
@override
|
||||
AddNoteScreenState createState() => AddNoteScreenState();
|
||||
}
|
||||
|
||||
class AddNoteScreenState extends State<AddNoteScreen> {
|
||||
late UserProvider user;
|
||||
late HomeworkProvider homeworkProvider;
|
||||
late DatabaseProvider databaseProvider;
|
||||
late SelfNoteProvider selfNoteProvider;
|
||||
|
||||
final _contentController = TextEditingController();
|
||||
final _titleController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_contentController.text = widget.initialNote?.content ?? '';
|
||||
_titleController.text = widget.initialNote?.title ?? '';
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
user = Provider.of<UserProvider>(context);
|
||||
homeworkProvider = Provider.of<HomeworkProvider>(context);
|
||||
databaseProvider = Provider.of<DatabaseProvider>(context);
|
||||
selfNoteProvider = Provider.of<SelfNoteProvider>(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
leading: BackButton(color: AppColors.of(context).text),
|
||||
title: Text(
|
||||
widget.initialNote == null ? 'new_note'.i18n : 'edit_note'.i18n,
|
||||
style: TextStyle(
|
||||
color: AppColors.of(context).text,
|
||||
fontSize: 26.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.1),
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// handle tap
|
||||
if (_contentController.text.replaceAll(' ', '') == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
var notes = selfNoteProvider.notes;
|
||||
|
||||
if (widget.initialNote == null) {
|
||||
notes.add(SelfNote.fromJson({
|
||||
'id': const Uuid().v4(),
|
||||
'title': _titleController.text.replaceAll(' ', '') == ''
|
||||
? null
|
||||
: _titleController.text,
|
||||
'content': _contentController.text
|
||||
}));
|
||||
} else {
|
||||
var i =
|
||||
notes.indexWhere((e) => e.id == widget.initialNote!.id);
|
||||
|
||||
notes[i] = SelfNote.fromJson({
|
||||
'id': notes[i].id,
|
||||
'title': _titleController.text.replaceAll(' ', '') == ''
|
||||
? null
|
||||
: _titleController.text,
|
||||
'content': _contentController.text,
|
||||
});
|
||||
}
|
||||
|
||||
await selfNoteProvider.store(notes);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
if (widget.initialNote != null) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.check,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color:
|
||||
Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withOpacity(.5)
|
||||
: Colors.white.withOpacity(.3),
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.check,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 22.0),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: _titleController,
|
||||
expands: false,
|
||||
maxLines: 1,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
hintText: "hint_t".i18n,
|
||||
hintStyle: const TextStyle(
|
||||
fontSize: 22.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(
|
||||
fontSize: 22.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _contentController,
|
||||
expands: true,
|
||||
minLines: null,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
hintText: "hint".i18n,
|
||||
hintStyle: const TextStyle(fontSize: 16.0),
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(fontSize: 16.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
153
refilc_mobile_ui/lib/screens/notes/note_view_screen.dart
Normal file
153
refilc_mobile_ui/lib/screens/notes/note_view_screen.dart
Normal file
@@ -0,0 +1,153 @@
|
||||
import 'package:refilc/api/providers/self_note_provider.dart';
|
||||
import 'package:refilc/models/self_note.dart';
|
||||
import 'package:refilc/theme/colors/colors.dart';
|
||||
import 'package:refilc_mobile_ui/screens/notes/add_note_screen.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class NoteViewScreen extends StatefulWidget {
|
||||
const NoteViewScreen({super.key, required this.note});
|
||||
|
||||
final SelfNote note;
|
||||
|
||||
@override
|
||||
NoteViewScreenState createState() => NoteViewScreenState();
|
||||
}
|
||||
|
||||
class NoteViewScreenState extends State<NoteViewScreen> {
|
||||
late SelfNoteProvider selfNoteProvider;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
selfNoteProvider = Provider.of<SelfNoteProvider>(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
leading: BackButton(color: AppColors.of(context).text),
|
||||
title: Text(
|
||||
widget.note.title ?? '${widget.note.content.split(' ')[0]}...',
|
||||
style: TextStyle(
|
||||
color: AppColors.of(context).text,
|
||||
fontSize: 26.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.1),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// handle tap
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
AddNoteScreen(initialNote: widget.note)));
|
||||
},
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.edit,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color:
|
||||
Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withOpacity(.5)
|
||||
: Colors.white.withOpacity(.3),
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.edit,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.1),
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// handle tap
|
||||
var notes = selfNoteProvider.notes;
|
||||
notes.removeWhere((e) => e.id == widget.note.id);
|
||||
await selfNoteProvider.store(notes);
|
||||
|
||||
// ignore: use_build_context_synchronously
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.trash2,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color:
|
||||
Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withOpacity(.5)
|
||||
: Colors.white.withOpacity(.3),
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.trash2,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.note.content,
|
||||
textAlign: TextAlign.justify,
|
||||
style: const TextStyle(fontSize: 18.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
282
refilc_mobile_ui/lib/screens/notes/notes_screen.dart
Normal file
282
refilc_mobile_ui/lib/screens/notes/notes_screen.dart
Normal file
@@ -0,0 +1,282 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:refilc/api/providers/database_provider.dart';
|
||||
import 'package:refilc/api/providers/self_note_provider.dart';
|
||||
import 'package:refilc/api/providers/user_provider.dart';
|
||||
import 'package:refilc/theme/colors/colors.dart';
|
||||
import 'package:refilc/utils/format.dart';
|
||||
import 'package:refilc_kreta_api/models/homework.dart';
|
||||
import 'package:refilc_kreta_api/providers/homework_provider.dart';
|
||||
import 'package:refilc_mobile_ui/common/empty.dart';
|
||||
import 'package:refilc_mobile_ui/common/panel/panel.dart';
|
||||
import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart';
|
||||
import 'package:refilc_mobile_ui/common/widgets/tick_tile.dart';
|
||||
import 'package:refilc_mobile_ui/screens/notes/add_note_screen.dart';
|
||||
import 'package:refilc_mobile_ui/screens/notes/note_view_screen.dart';
|
||||
import 'package:refilc_mobile_ui/screens/notes/notes_screen.i18n.dart';
|
||||
import 'package:refilc_mobile_ui/screens/notes/self_note_tile.dart';
|
||||
import 'package:refilc_plus/providers/premium_provider.dart';
|
||||
import 'package:refilc_plus/ui/mobile/premium/premium_inline.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class NotesScreen extends StatefulWidget {
|
||||
const NotesScreen({super.key, required this.doneItems});
|
||||
|
||||
final Map<String, bool> doneItems;
|
||||
|
||||
@override
|
||||
NotesScreenState createState() => NotesScreenState();
|
||||
}
|
||||
|
||||
class NotesScreenState extends State<NotesScreen> {
|
||||
late UserProvider user;
|
||||
late HomeworkProvider homeworkProvider;
|
||||
late DatabaseProvider databaseProvider;
|
||||
late SelfNoteProvider selfNoteProvider;
|
||||
|
||||
List<Widget> noteTiles = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
user = Provider.of<UserProvider>(context);
|
||||
homeworkProvider = Provider.of<HomeworkProvider>(context);
|
||||
databaseProvider = Provider.of<DatabaseProvider>(context);
|
||||
selfNoteProvider = Provider.of<SelfNoteProvider>(context);
|
||||
|
||||
void generateTiles() {
|
||||
List<Widget> tiles = [];
|
||||
|
||||
List<Homework> hw = homeworkProvider.homework
|
||||
.where((e) => e.deadline.isAfter(DateTime.now()))
|
||||
// e.deadline.isBefore(DateTime(DateTime.now().year,
|
||||
// DateTime.now().month, DateTime.now().day + 3)))
|
||||
.toList();
|
||||
|
||||
// todo tiles
|
||||
List<Widget> toDoTiles = [];
|
||||
|
||||
if (hw.isNotEmpty) {
|
||||
toDoTiles.addAll(hw.map((e) => TickTile(
|
||||
padding: EdgeInsets.zero,
|
||||
title: 'homework'.i18n,
|
||||
description:
|
||||
'${(e.subject.isRenamed ? e.subject.renamedTo : e.subject.name) ?? ''}, ${e.content.escapeHtml()}',
|
||||
isTicked: widget.doneItems[e.id] ?? false,
|
||||
onTap: (p0) async {
|
||||
if (!widget.doneItems.containsKey(e.id)) {
|
||||
widget.doneItems.addAll({e.id: p0});
|
||||
} else {
|
||||
widget.doneItems[e.id] = p0;
|
||||
}
|
||||
await databaseProvider.userStore
|
||||
.storeToDoItem(widget.doneItems, userId: user.id!);
|
||||
},
|
||||
)));
|
||||
}
|
||||
|
||||
if (toDoTiles.isNotEmpty) {
|
||||
tiles.add(Panel(
|
||||
title: Text('todo'.i18n),
|
||||
child: Column(
|
||||
children: toDoTiles,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
// self notes
|
||||
List<Widget> selfNoteTiles = [];
|
||||
|
||||
if (selfNoteProvider.notes.isNotEmpty) {
|
||||
selfNoteTiles.addAll(selfNoteProvider.notes.map(
|
||||
(e) => SelfNoteTile(
|
||||
title: e.title ?? e.content.split(' ')[0],
|
||||
content: e.content,
|
||||
onTap: () => Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => NoteViewScreen(note: e))),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
if (selfNoteTiles.isNotEmpty) {
|
||||
// padding
|
||||
tiles.add(const SizedBox(
|
||||
height: 28.0,
|
||||
));
|
||||
|
||||
// actual thing
|
||||
tiles.add(Panel(
|
||||
title: Text('your_notes'.i18n),
|
||||
padding: EdgeInsets.zero,
|
||||
isTransparent: true,
|
||||
child: Wrap(
|
||||
spacing: 18.0,
|
||||
runSpacing: 18.0,
|
||||
children: selfNoteTiles,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
// insert empty tile
|
||||
if (tiles.isEmpty) {
|
||||
tiles.insert(
|
||||
0,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 24.0),
|
||||
child: Empty(subtitle: "empty".i18n),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
tiles.add(Provider.of<PremiumProvider>(context, listen: false).hasPremium
|
||||
? const SizedBox()
|
||||
: const Padding(
|
||||
padding: EdgeInsets.only(top: 24.0),
|
||||
child: PremiumInline(features: [
|
||||
PremiumInlineFeature.stats,
|
||||
]),
|
||||
));
|
||||
|
||||
// padding
|
||||
tiles.add(const SizedBox(height: 32.0));
|
||||
|
||||
noteTiles = List.castFrom(tiles);
|
||||
}
|
||||
|
||||
generateTiles();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
leading: BackButton(color: AppColors.of(context).text),
|
||||
title: Text(
|
||||
"notes".i18n,
|
||||
style: TextStyle(
|
||||
color: AppColors.of(context).text,
|
||||
fontSize: 26.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.1),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// handle tap
|
||||
SoonAlert.show(context: context);
|
||||
},
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.search,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color:
|
||||
Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withOpacity(.5)
|
||||
: Colors.white.withOpacity(.3),
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.search,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.1),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// handle tap
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => const AddNoteScreen()));
|
||||
},
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.plus,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
IconTheme(
|
||||
data: IconThemeData(
|
||||
color:
|
||||
Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withOpacity(.5)
|
||||
: Colors.white.withOpacity(.3),
|
||||
),
|
||||
child: const Icon(
|
||||
FeatherIcons.plus,
|
||||
size: 20.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () {
|
||||
Provider.of<HomeworkProvider>(context, listen: false)
|
||||
.fetch(from: DateTime.now().subtract(const Duration(days: 30)));
|
||||
Provider.of<SelfNoteProvider>(context, listen: false).restore();
|
||||
|
||||
return Future(() => null);
|
||||
},
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
itemCount: max(noteTiles.length, 1),
|
||||
itemBuilder: (context, index) {
|
||||
if (noteTiles.isNotEmpty) {
|
||||
EdgeInsetsGeometry panelPadding =
|
||||
const EdgeInsets.symmetric(horizontal: 24.0);
|
||||
|
||||
return Padding(padding: panelPadding, child: noteTiles[index]);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
45
refilc_mobile_ui/lib/screens/notes/notes_screen.i18n.dart
Normal file
45
refilc_mobile_ui/lib/screens/notes/notes_screen.i18n.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:i18n_extension/i18n_extension.dart';
|
||||
|
||||
extension SettingsLocalization on String {
|
||||
static final _t = Translations.byLocale("hu_hu") +
|
||||
{
|
||||
"en_en": {
|
||||
"notes": "Notes",
|
||||
"empty": "You don't have any notes",
|
||||
"todo": "Tasks",
|
||||
"homework": "Homework",
|
||||
"new_note": "New Note",
|
||||
"edit_note": "Edit Note",
|
||||
"hint": "Note content...",
|
||||
"hint_t": "Note title...",
|
||||
"your_notes": "Your Notes",
|
||||
},
|
||||
"hu_hu": {
|
||||
"notes": "Füzet",
|
||||
"empty": "Nincsenek jegyzeteid",
|
||||
"todo": "Feladatok",
|
||||
"homework": "Házi feladat",
|
||||
"new_note": "Új jegyzet",
|
||||
"edit_note": "Jegyzet szerkesztése",
|
||||
"hint": "Jegyzet tartalma...",
|
||||
"hint_t": "Jegyzet címe...",
|
||||
"your_notes": "Jegyzeteid",
|
||||
},
|
||||
"de_de": {
|
||||
"notes": "Broschüre",
|
||||
"empty": "Sie haben keine Notizen",
|
||||
"todo": "Aufgaben",
|
||||
"homework": "Hausaufgaben",
|
||||
"new_note": "Neue Notiz",
|
||||
"edit_note": "Notiz bearbeiten",
|
||||
"hint": "Inhalt beachten...",
|
||||
"hint_t": "Titel notieren...",
|
||||
"your_notes": "Deine Noten",
|
||||
},
|
||||
};
|
||||
|
||||
String get i18n => localize(this, _t);
|
||||
String fill(List<Object> params) => localizeFill(this, params);
|
||||
String plural(int value) => localizePlural(value, this, _t);
|
||||
String version(Object modifier) => localizeVersion(modifier, this, _t);
|
||||
}
|
||||
64
refilc_mobile_ui/lib/screens/notes/self_note_tile.dart
Normal file
64
refilc_mobile_ui/lib/screens/notes/self_note_tile.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'package:refilc/models/settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SelfNoteTile extends StatelessWidget {
|
||||
const SelfNoteTile(
|
||||
{super.key, required this.title, required this.content, this.onTap});
|
||||
|
||||
final String title;
|
||||
final String content;
|
||||
final Function()? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 172.0,
|
||||
width: 172.0,
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
boxShadow: [
|
||||
if (Provider.of<SettingsProvider>(context, listen: false)
|
||||
.shadowEffect)
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 21),
|
||||
blurRadius: 23.0,
|
||||
color: Theme.of(context).shadowColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
content.replaceAll('\n', ' '),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 6,
|
||||
style: const TextStyle(fontSize: 17.0),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
SizedBox(
|
||||
width: 152.0,
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user