公告切换

hmxc
小赖 4 years ago
parent 8c67e8c28f
commit 08f86b30ae

@ -1,3 +1,3 @@
{
"flutterSdkVersion": "2.0.0"
"flutterSdkVersion": "stable"
}

@ -1,6 +1,4 @@
import 'dart:async';
import 'dart:math';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/cupertino.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/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/utils/headers.dart';
@ -22,26 +19,6 @@ class HomeNotification extends StatefulWidget {
}
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
Widget build(BuildContext context) {
@ -57,20 +34,17 @@ class _HomeNotificationState extends State<HomeNotification> {
24.wb,
widget.items.isEmpty
? Spacer()
: GestureDetector(
onTap: () {
if (randomItem != null)
Get.to(() => NoticeDetailPage(id: randomItem.id));
},
child: AnimatedSwitcher(
duration: Duration(milliseconds: 1000),
child: Align(
: Container(
alignment: Alignment.centerLeft,
key: ObjectKey(randomItem),
child: Text(randomItem?.title ?? ''),
height: 85.w,
child: AnimatedTextKit(
animatedTexts: widget.items
.map((e) => RotateAnimatedText(e.title))
.toList(),
repeatForever: true,
),
),
).expand(),
Spacer(),
MaterialButton(
shape: StadiumBorder(),
padding: EdgeInsets.symmetric(horizontal: 12.w),

@ -24,6 +24,13 @@ packages:
url: "http://159.75.73.143:8080/third_packages/amap_flutter_map"
source: git
version: "2.0.2-nullsafety"
animated_text_kit:
dependency: "direct main"
description:
name: animated_text_kit
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.1"
animator:
dependency: transitive
description:

@ -12,17 +12,12 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
# 权限组件
permission_handler: ^6.1.1
# 版本信息
package_info: ^2.0.0
provider: ^5.0.0
# 屏幕适配
flutter_screenutil: ^5.0.0-nullsafety.11
cupertino_icons: ^1.0.2
# 打电话等各种功能
url_launcher: ^6.0.2
# 工具类
flustars: ^2.0.1
# icons
# TODO need remove
@ -70,6 +65,7 @@ dependencies:
ref: nullsafety
amap_flutter_location: ^1.0.1
amap_flutter_base: ^1.0.2
animated_text_kit: ^4.1.1
dev_dependencies:
flutter_test:

Loading…
Cancel
Save