forked from firka/firka
message toast -> screen
the design has a screen for messages not a toast
This commit is contained in:
@@ -10,7 +10,6 @@ import '../../main.dart';
|
||||
import '../../ui/model/style.dart';
|
||||
import '../../ui/phone/widgets/lesson.dart';
|
||||
import '../../ui/widget/class_icon.dart';
|
||||
import '../api/model/notice_board.dart';
|
||||
import '../api/model/timetable.dart';
|
||||
import 'firka_card.dart';
|
||||
import 'grade.dart';
|
||||
@@ -290,137 +289,3 @@ Future<void> showGradeBottomSheet(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showAnnouncementBottomSheet(
|
||||
BuildContext context, AppInitialization data, InfoBoardItem info) async {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
elevation: 100,
|
||||
isScrollControlled: true,
|
||||
enableDrag: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
barrierColor: appStyle.colors.a15p,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.9,
|
||||
),
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(color: Colors.transparent),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
child: Text(
|
||||
info.title,
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.H_H2
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
info.date.format(data.l10n, FormatMode.yyyymmdd),
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.B_16R
|
||||
.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 56),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: appStyle.colors.accent,
|
||||
shape: CircleBorder(
|
||||
eccentricity: 1,
|
||||
)),
|
||||
child: SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Text(
|
||||
info.author[0],
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
fontSize: 20,
|
||||
color: appStyle.colors.textPrimary),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width / 1.4,
|
||||
child: Text(
|
||||
info.author,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.card,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(16))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
info.contentText,
|
||||
style: appStyle.fonts.B_16R
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:firka/helpers/api/model/grade.dart';
|
||||
import 'package:firka/helpers/extensions.dart';
|
||||
import 'package:firka/helpers/ui/common_bottom_sheets.dart';
|
||||
import 'package:firka/ui/phone/screens/message/message_screen.dart';
|
||||
import 'package:firka/ui/phone/widgets/home_main_starting_soon.dart';
|
||||
import 'package:firka/ui/phone/widgets/info_board_item.dart';
|
||||
import 'package:firka/ui/phone/widgets/lesson_small.dart';
|
||||
@@ -224,7 +225,8 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
GestureDetector(
|
||||
child: InfoBoardItemWidget(item),
|
||||
onTap: () {
|
||||
showAnnouncementBottomSheet(context, widget.data, item);
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => MessageScreen(widget.data, item)));
|
||||
},
|
||||
),
|
||||
item.date
|
||||
|
||||
165
firka/lib/ui/phone/screens/message/message_screen.dart
Normal file
165
firka/lib/ui/phone/screens/message/message_screen.dart
Normal file
@@ -0,0 +1,165 @@
|
||||
import 'package:firka/helpers/extensions.dart';
|
||||
import 'package:firka/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
import '../../../../helpers/api/model/notice_board.dart';
|
||||
import '../../../../helpers/firka_bundle.dart';
|
||||
import '../../../model/style.dart';
|
||||
import '../../../widget/firka_icon.dart';
|
||||
|
||||
class MessageScreen extends StatelessWidget {
|
||||
final AppInitialization data;
|
||||
final InfoBoardItem info;
|
||||
|
||||
const MessageScreen(this.data, this.info, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultAssetBundle(
|
||||
bundle: FirkaBundle(),
|
||||
child: Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: SafeArea(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.background,
|
||||
borderRadius:
|
||||
BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 0),
|
||||
child: GestureDetector(
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.chevronLeftLine,
|
||||
color: appStyle.colors.textSecondary),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
Transform.translate(
|
||||
offset: const Offset(-4, 1),
|
||||
child: Text(
|
||||
data.l10n.s_a,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 56),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
child: Text(
|
||||
info.title,
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.H_H2.apply(
|
||||
color: appStyle.colors.textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
info.date
|
||||
.format(data.l10n, FormatMode.yyyymmdd),
|
||||
textAlign: TextAlign.center,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 56),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: appStyle.colors.accent,
|
||||
shape: CircleBorder(
|
||||
eccentricity: 1,
|
||||
)),
|
||||
child: SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 6),
|
||||
child: Text(
|
||||
info.author[0],
|
||||
style: appStyle.fonts.H_18px.copyWith(
|
||||
fontSize: 20,
|
||||
color:
|
||||
appStyle.colors.textPrimary),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width:
|
||||
MediaQuery.of(context).size.width / 1.4,
|
||||
child: Text(
|
||||
info.author,
|
||||
style: appStyle.fonts.B_16SB.apply(
|
||||
color: appStyle.colors.textPrimary),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.card,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(16))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
info.contentText,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user