BioFlux/lib/screens/feedback_screen.dart
2026-01-22 16:33:07 +08:00

89 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../widgets/glass_card.dart';
class FeedbackScreen extends StatefulWidget {
const FeedbackScreen({super.key});
@override
State<FeedbackScreen> createState() => _FeedbackScreenState();
}
class _FeedbackScreenState extends State<FeedbackScreen> {
final TextEditingController _controller = TextEditingController();
bool _isSubmitting = false;
void _submit() async {
if (_controller.text.isEmpty) return;
setState(() => _isSubmitting = true);
// 模拟提交过程
// 显示成功提示
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text("Feedback sent! Thank you.", style: GoogleFonts.lato()),
backgroundColor: const Color(0xFF00BFFF),
behavior: SnackBarBehavior.floating,
duration: const Duration(milliseconds: 1500),
)
);
// 0.8秒后返回
await Future.delayed(const Duration(milliseconds: 800));
if (mounted) {
Navigator.pop(context);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Send Feedback", style: GoogleFonts.montserrat(fontWeight: FontWeight.bold)),
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
children: [
GlassCard(
child: TextField(
controller: _controller,
maxLines: 6,
decoration: InputDecoration(
hintText: "Tell us what you think...",
hintStyle: GoogleFonts.lato(color: Colors.grey),
border: InputBorder.none,
),
style: GoogleFonts.lato(),
),
),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: _isSubmitting ? null : _submit,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF00BFFF),
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
elevation: 0,
),
child: _isSubmitting
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
: Text("Submit Feedback", style: GoogleFonts.montserrat(fontWeight: FontWeight.bold)),
),
),
],
),
),
);
}
}