公告切换

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 '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: () {
if (randomItem != null)
Get.to(() => NoticeDetailPage(id: randomItem.id));
},
child: AnimatedSwitcher(
duration: Duration(milliseconds: 1000),
child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
key: ObjectKey(randomItem), height: 85.w,
child: Text(randomItem?.title ?? ''), child: AnimatedTextKit(
animatedTexts: widget.items
.map((e) => RotateAnimatedText(e.title))
.toList(),
repeatForever: true,
), ),
), ),
).expand(), Spacer(),
MaterialButton( MaterialButton(
shape: StadiumBorder(), shape: StadiumBorder(),
padding: EdgeInsets.symmetric(horizontal: 12.w), padding: EdgeInsets.symmetric(horizontal: 12.w),

@ -24,6 +24,13 @@ packages:
url: "http://159.75.73.143:8080/third_packages/amap_flutter_map" url: "http://159.75.73.143:8080/third_packages/amap_flutter_map"
source: git source: git
version: "2.0.2-nullsafety" 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: animator:
dependency: transitive dependency: transitive
description: description:

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

Loading…
Cancel
Save