From c612dc46f185716a90a73c48d226f41573982f89 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Fri, 5 Feb 2021 14:39:48 +0800 Subject: [PATCH] remove sh*t popup --- lib/pages/one_alarm/alarm_detail_page.dart | 25 +++++ lib/pages/one_alarm/widget/alarm_page.dart | 51 +--------- .../one_alarm/widget/explain_template.dart | 93 ------------------- pubspec.lock | 7 -- pubspec.yaml | 2 - 5 files changed, 30 insertions(+), 148 deletions(-) create mode 100644 lib/pages/one_alarm/alarm_detail_page.dart delete mode 100644 lib/pages/one_alarm/widget/explain_template.dart diff --git a/lib/pages/one_alarm/alarm_detail_page.dart b/lib/pages/one_alarm/alarm_detail_page.dart new file mode 100644 index 00000000..0898ca91 --- /dev/null +++ b/lib/pages/one_alarm/alarm_detail_page.dart @@ -0,0 +1,25 @@ +import 'package:akuCommunity/utils/headers.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; + +class AlarmDetailPage extends StatelessWidget { + const AlarmDetailPage({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '功能说明', + body: ListView( + padding: EdgeInsets.all(32.w), + children: [ + '一键报警'.text.size(32.sp).bold.make(), + 20.hb, + '点击“呼叫110”后,您可以直接拨打本地110。页面中提供了您当前所在位置,以便您与警方沟通。(GPS信号弱时,位置可能存在偏移)' + .text + .size(28.sp) + .make(), + ], + ), + ); + } +} diff --git a/lib/pages/one_alarm/widget/alarm_page.dart b/lib/pages/one_alarm/widget/alarm_page.dart index 5d93b905..aacf625f 100644 --- a/lib/pages/one_alarm/widget/alarm_page.dart +++ b/lib/pages/one_alarm/widget/alarm_page.dart @@ -1,18 +1,18 @@ // Flutter imports: +import 'package:akuCommunity/pages/one_alarm/alarm_detail_page.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:amap_location_fluttify/amap_location_fluttify.dart'; import 'package:amap_map_fluttify/amap_map_fluttify.dart'; -import 'package:flutter_beautiful_popup/main.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:velocity_x/velocity_x.dart'; // Project imports: -import 'package:akuCommunity/pages/one_alarm/widget/explain_template.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; @@ -41,41 +41,6 @@ class _AlarmPageState extends State { AmapController _amapController; Location _location; - void showExplain(BuildContext context) { - final popup = BeautifulPopup.customize( - context: context, - build: (options) => ExplainTemplate(options), - ); - popup.show( - title: Text( - '功能说明', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 32.sp, - color: Color(0xff15c0ec), - ), - ), - content: Text( - '点击“呼叫110”后,您可以直接拨打本地110。页面中提供了您当前所在位置,以便您与警方沟通。(GPS信号弱时,位置可能存在偏移)', - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff666666), - ), - ), - actions: [ - MaterialButton( - color: Color(0xff15c0ec), - textColor: Colors.white, - shape: RoundedRectangleBorder( - side: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(50))), - child: Text('关闭'), - onPressed: Navigator.of(context).pop, - ) - ], - close: SizedBox()); - } - @override void initState() { super.initState(); @@ -96,15 +61,9 @@ class _AlarmPageState extends State { return BeeScaffold( title: '一键报警', actions: [ - InkWell( - onTap: () { - showExplain(context); - }, - child: Container( - padding: EdgeInsets.fromLTRB(32.w, 28.w, 32.w, 20.w), - child: '全部已读'.text.black.size(28.sp).make(), - alignment: Alignment.center, - ), + MaterialButton( + onPressed: () => Get.to(AlarmDetailPage()), + child: '功能说明'.text.black.size(28.sp).make(), ) ], body: Stack( diff --git a/lib/pages/one_alarm/widget/explain_template.dart b/lib/pages/one_alarm/widget/explain_template.dart deleted file mode 100644 index 4836ba9c..00000000 --- a/lib/pages/one_alarm/widget/explain_template.dart +++ /dev/null @@ -1,93 +0,0 @@ -// Dart imports: -import 'dart:ui'; - -// Flutter imports: -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_beautiful_popup/main.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - -// Project imports: -import 'package:akuCommunity/utils/headers.dart'; - -class ExplainTemplate extends BeautifulPopupTemplate { - final BeautifulPopup options; - ExplainTemplate(this.options) : super(options); - - @override - final illustrationPath = 'img/bg/authentication.png'; - @override - Color get primaryColor => options.primaryColor ?? Color(0xff15c0ec); - @override - final maxWidth = 400.w; - @override - final maxHeight = 617.w; - @override - final bodyMargin = 0; - @override - get layout { - return [ - Positioned( - child: background, - ), - Positioned( - top: percentH(32), - child: title, - ), - Positioned( - top: percentH(42), - left: percentW(10), - right: percentW(10), - height: percentH(actions == null ? 52 : 38), - child: content, - ), - Positioned( - bottom: percentW(8), - left: percentW(8), - right: percentW(8), - child: actions ?? Container(), - ), - ]; - } -} - -// class Explain extends StatelessWidget { -// const Explain({Key key}) : super(key: key); - -// @override -// Widget build(BuildContext context) { -// return Container( -// color: Colors.white, -// padding: EdgeInsets.only( -// top: 32.w, -// left: 32.w, -// right: 32.w, -// ), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Text( -// '一键报警', -// style: TextStyle( -// fontSize: BaseStyle.fontSize32, -// color: ktextPrimary, -// fontWeight: FontWeight.bold, -// ), -// ), -// Container( -// margin: EdgeInsets.only(top: 20.w), -// child: Text( -// '点击“呼叫110”后,您可以直接拨打本地110。页面中提供了您当前所在位置,以便您与警方沟通。(GPS信号弱时,位置可能存在偏移)', -// style: TextStyle( -// fontSize: BaseStyle.fontSize28, -// color: ktextSubColor, -// ), -// ), -// ), -// ], -// ), -// ); -// } -// } diff --git a/pubspec.lock b/pubspec.lock index 4422454d..362f28a6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -328,13 +328,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.6.1" - flutter_beautiful_popup: - dependency: "direct main" - description: - name: flutter_beautiful_popup - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.5.0" flutter_blurhash: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b06b4409..f89c5dd0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,8 +44,6 @@ dependencies: fluro: ^1.6.3 #滑动卡片 font_awesome_flutter: ^8.8.1 - #弹窗 - flutter_beautiful_popup: ^1.5.0 #图片预览 photo_view: ^0.10.2 #图片缓存