changed everything from filcnaplo to refilc finally
This commit is contained in:
56
refilc_mobile_ui/lib/common/widgets/note/note_tile.dart
Normal file
56
refilc_mobile_ui/lib/common/widgets/note/note_tile.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:refilc_kreta_api/models/note.dart';
|
||||
import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NoteTile extends StatelessWidget {
|
||||
const NoteTile(this.note, {super.key, this.onTap, this.padding});
|
||||
|
||||
final Note note;
|
||||
final void Function()? onTap;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Padding(
|
||||
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
),
|
||||
child: ListTile(
|
||||
visualDensity: VisualDensity.compact,
|
||||
contentPadding: const EdgeInsets.only(left: 8.0, right: 12.0),
|
||||
onTap: onTap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14.0)),
|
||||
leading: ProfileImage(
|
||||
isNotePfp: true,
|
||||
name: (note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
radius: 19.2,
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
title: Text(
|
||||
note.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text(
|
||||
note.content.replaceAll('\n', ' '),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
84
refilc_mobile_ui/lib/common/widgets/note/note_view.dart
Normal file
84
refilc_mobile_ui/lib/common/widgets/note/note_view.dart
Normal file
@@ -0,0 +1,84 @@
|
||||
import 'package:refilc/utils/color.dart';
|
||||
import 'package:refilc_kreta_api/models/note.dart';
|
||||
import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart';
|
||||
import 'package:refilc/utils/format.dart';
|
||||
import 'package:refilc_mobile_ui/common/sliding_bottom_sheet.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart';
|
||||
import 'package:flutter_linkify/flutter_linkify.dart';
|
||||
|
||||
class NoteView extends StatelessWidget {
|
||||
const NoteView(this.note, {super.key});
|
||||
|
||||
final Note note;
|
||||
|
||||
static void show(Note note, {required BuildContext context}) =>
|
||||
showSlidingBottomSheet(context: context, child: NoteView(note));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Header
|
||||
ListTile(
|
||||
leading: ProfileImage(
|
||||
name: (note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
radius: 22.0,
|
||||
backgroundColor: ColorUtils.stringToColor(
|
||||
(note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
note.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text(
|
||||
(note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
trailing: Text(
|
||||
note.date.format(context),
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
|
||||
// Details
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: SelectableLinkify(
|
||||
text: note.content.escapeHtml(),
|
||||
options: const LinkifyOptions(looseUrl: true, removeWww: true),
|
||||
onOpen: (link) {
|
||||
launch(link.url,
|
||||
customTabsOption: CustomTabsOption(
|
||||
toolbarColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
showPageTitle: true,
|
||||
));
|
||||
},
|
||||
style: const TextStyle(fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
18
refilc_mobile_ui/lib/common/widgets/note/note_viewable.dart
Normal file
18
refilc_mobile_ui/lib/common/widgets/note/note_viewable.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:refilc_kreta_api/models/note.dart';
|
||||
import 'package:refilc_mobile_ui/common/widgets/note/note_tile.dart';
|
||||
import 'package:refilc_mobile_ui/common/widgets/note/note_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NoteViewable extends StatelessWidget {
|
||||
const NoteViewable(this.note, {super.key});
|
||||
|
||||
final Note note;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return NoteTile(
|
||||
note,
|
||||
onTap: () => NoteView.show(note, context: context),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user