ModernMemoires/lib/views/write_page/writeOld_page.dart

82 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
class WritePageOLD extends StatefulWidget {
final double moodPercentage;
const WritePageOLD({Key? key, required this.moodPercentage})
: super(key: key);
@override
_WritePageState createState() => _WritePageState();
}
class _WritePageState extends State<WritePageOLD> {
final TextEditingController _textController = TextEditingController();
bool _hasText = false;
@override
void initState() {
super.initState();
_textController.addListener(() {
setState(() {
_hasText = _textController.text.isNotEmpty;
});
});
}
@override
void dispose() {
_textController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Displaying the mood percentage
Text(
"${widget.moodPercentage.toStringAsFixed(0)}%",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
SizedBox(height: 8),
Text("Today", style: TextStyle(fontSize: 20)),
SizedBox(height: 4),
Text(
"Why was today only ${widget.moodPercentage.toStringAsFixed(0)}% good?",
style: TextStyle(fontSize: 16),
),
SizedBox(height: 20),
// Text area
Expanded(
child: TextField(
controller: _textController,
maxLines: null, // Allows for unlimited lines
expands: true,
decoration: InputDecoration(
hintText: "Enter your thoughts here...",
border: OutlineInputBorder(),
),
),
),
],
),
),
),
// Dynamic Save or Skip button
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
// Implement save or skip functionality
},
label: Text(_hasText ? 'Save' : 'Skip'),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
}
}