TempoFlow/lib/pages/feedback_page.dart

105 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import '../theme/app_theme.dart';
class FeedbackPage extends StatefulWidget {
const FeedbackPage({super.key});
@override
State<FeedbackPage> createState() => _FeedbackPageState();
}
class _FeedbackPageState extends State<FeedbackPage> {
final TextEditingController _textController = TextEditingController();
bool _isSubmitting = false;
void _handleSubmit() async {
if (_textController.text.trim().isEmpty) return;
FocusScope.of(context).unfocus();
setState(() => _isSubmitting = true);
await Future.delayed(const Duration(milliseconds: 800));
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text("Thank you for your feedback!"),
backgroundColor: AppTheme.primary,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
),
);
Navigator.pop(context);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppTheme.bgLight,
appBar: AppBar(
title: const Text("Feedback"),
centerTitle: true,
backgroundColor: Colors.transparent,
),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: AppTheme.softShadow,
),
child: TextField(
controller: _textController,
maxLines: 8,
style: const TextStyle(
color: AppTheme.textMain,
fontSize: 16,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
hintText: "Tell us what you think...",
hintStyle: TextStyle(color: Colors.grey[500]),
border: InputBorder.none,
contentPadding: const EdgeInsets.all(20),
),
),
),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.primary,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
elevation: 0,
),
onPressed: _isSubmitting ? null : _handleSubmit,
child: _isSubmitting
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: const Text(
"Submit Feedback",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
),
],
),
),
);
}
}