mobdr/lib/ui/general/notification.dart

107 lines
3.3 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mobdr/config/constant.dart';
import 'package:mobdr/config/global_style.dart';
import 'package:mobdr/ui/reusable/reusable_widget.dart';
import 'package:mobdr/service/plausible.dart';
import 'package:mobdr/service/logger_util.dart';
import 'package:mobdr/cubit/language/app_localizations.dart';
class NotificationPage extends StatefulWidget {
@override
_NotificationPageState createState() => _NotificationPageState();
}
class _NotificationPageState extends State<NotificationPage> {
// initialize reusable widget
final _reusableWidget = ReusableWidget();
@override
void initState() {
super.initState();
// track & log page access
final page = 'notification';
LoggerUtil.dblog('LOG', 'MOBDR', 'Page : ${page}', 0);
PlausibleUtil.addEventAsync(name: 'pageview', page: page);
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
iconTheme: IconThemeData(
color: GlobalStyle.appBarIconThemeColor,
),
elevation: GlobalStyle.appBarElevation,
title: Text(AppLocalizations.of(context)!.translate('i18n_menu_notification'),
style: GlobalStyle.appBarTitle,
),
backgroundColor: GlobalStyle.appBarBackgroundColor,
systemOverlayStyle: GlobalStyle.appBarSystemOverlayStyle,
bottom: _reusableWidget.bottomAppBar(),
),
body: WillPopScope(
onWillPop: () {
Navigator.pop(context);
return Future.value(true);
},
child: Container(child: ListView(children: <Widget>[])),
));
}
Widget _createItem(
{required String notifDate,
required String notifTitle,
required String notifMessage,
StatefulWidget? page}) {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
if (page != null) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => page));
}
},
child: Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(notifTitle,
style: TextStyle(
fontWeight: FontWeight.bold, color: CHARCOAL)),
SizedBox(
height: 4,
),
Text(notifDate,
style:
TextStyle(color: Colors.grey[400], fontSize: 11)),
SizedBox(
height: 8,
),
Text(notifMessage, style: TextStyle(color: BLACK_GREY)),
],
)),
Divider(
height: 1,
color: Colors.grey[400],
),
],
),
),
);
}
}