37 lines
814 B
Dart
37 lines
814 B
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
|
|
|
class FeedBackController extends GetxController with WidgetsBindingObserver {
|
|
///email输入文本
|
|
final TextEditingController feedbackTextController = TextEditingController();
|
|
|
|
/// 输入框焦点
|
|
FocusNode focusNode = FocusNode();
|
|
|
|
Timer? _timer;
|
|
|
|
@override
|
|
void onClose() {
|
|
super.onClose();
|
|
_stopTimer();
|
|
}
|
|
|
|
submit({String? text}) {
|
|
loading(show: true);
|
|
_timer = Timer.periodic(const Duration(seconds: 1), (Timer t) {
|
|
dismiss(dismiss: true);
|
|
toast("Thank you for your feedback!!");
|
|
_stopTimer();
|
|
});
|
|
}
|
|
|
|
/// 停止定时器
|
|
void _stopTimer() {
|
|
_timer?.cancel();
|
|
_timer = null;
|
|
}
|
|
}
|