|
|
@ -1,6 +1,4 @@
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:animated_text_kit/animated_text_kit.dart';
|
|
|
|
import 'dart:math';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -9,7 +7,6 @@ import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:akuCommunity/const/resource.dart';
|
|
|
|
import 'package:akuCommunity/const/resource.dart';
|
|
|
|
import 'package:akuCommunity/model/community/board_model.dart';
|
|
|
|
import 'package:akuCommunity/model/community/board_model.dart';
|
|
|
|
import 'package:akuCommunity/ui/community/notice/notice_detail_page.dart';
|
|
|
|
|
|
|
|
import 'package:akuCommunity/ui/community/notice/notice_page.dart';
|
|
|
|
import 'package:akuCommunity/ui/community/notice/notice_page.dart';
|
|
|
|
import 'package:akuCommunity/utils/headers.dart';
|
|
|
|
import 'package:akuCommunity/utils/headers.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -22,26 +19,6 @@ class HomeNotification extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _HomeNotificationState extends State<HomeNotification> {
|
|
|
|
class _HomeNotificationState extends State<HomeNotification> {
|
|
|
|
BoardItemModel get randomItem {
|
|
|
|
|
|
|
|
if (widget.items.isEmpty) return null;
|
|
|
|
|
|
|
|
int index = Random().nextInt(widget.items.length - 1);
|
|
|
|
|
|
|
|
return widget.items[index];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer _timer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
_timer = Timer.periodic(
|
|
|
|
|
|
|
|
Duration(milliseconds: 5000), (timer) => setState(() {}));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
_timer?.cancel();
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
@ -57,20 +34,17 @@ class _HomeNotificationState extends State<HomeNotification> {
|
|
|
|
24.wb,
|
|
|
|
24.wb,
|
|
|
|
widget.items.isEmpty
|
|
|
|
widget.items.isEmpty
|
|
|
|
? Spacer()
|
|
|
|
? Spacer()
|
|
|
|
: GestureDetector(
|
|
|
|
: Container(
|
|
|
|
onTap: () {
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
if (randomItem != null)
|
|
|
|
height: 85.w,
|
|
|
|
Get.to(() => NoticeDetailPage(id: randomItem.id));
|
|
|
|
child: AnimatedTextKit(
|
|
|
|
},
|
|
|
|
animatedTexts: widget.items
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
.map((e) => RotateAnimatedText(e.title))
|
|
|
|
duration: Duration(milliseconds: 1000),
|
|
|
|
.toList(),
|
|
|
|
child: Align(
|
|
|
|
repeatForever: true,
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
|
|
|
key: ObjectKey(randomItem),
|
|
|
|
|
|
|
|
child: Text(randomItem?.title ?? ''),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).expand(),
|
|
|
|
),
|
|
|
|
|
|
|
|
Spacer(),
|
|
|
|
MaterialButton(
|
|
|
|
MaterialButton(
|
|
|
|
shape: StadiumBorder(),
|
|
|
|
shape: StadiumBorder(),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
|