75 lines
2.0 KiB
Dart
75 lines
2.0 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
import '../../utils/widgets/BottomNavigationWidget.dart';
|
||
|
import '../../utils/widgets/MoodTextArea.dart';
|
||
|
import '../../utils/widgets/QuestionSliderWidget.dart';
|
||
|
|
||
|
void main() => runApp(MyApp());
|
||
|
|
||
|
class MyApp extends StatelessWidget {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return MaterialApp(
|
||
|
title: 'Flutter Demo',
|
||
|
home: HomePage(),
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class HomePage extends StatefulWidget {
|
||
|
const HomePage({super.key});
|
||
|
|
||
|
@override
|
||
|
State<HomePage> createState() => _HomePageState();
|
||
|
}
|
||
|
|
||
|
class _HomePageState extends State<HomePage> {
|
||
|
double _sliderValue = 50.0;
|
||
|
bool _isTextAreaEditable = false;
|
||
|
|
||
|
void _toggleTextAreaEditability() {
|
||
|
setState(() {
|
||
|
_isTextAreaEditable = !_isTextAreaEditable;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
body: SafeArea(
|
||
|
child: SingleChildScrollView(
|
||
|
child: Column(
|
||
|
children: [
|
||
|
QuestionSliderWidget(
|
||
|
date: DateTime.now(),
|
||
|
questionText: 'Sample Question',
|
||
|
initialSliderValue: _sliderValue,
|
||
|
isSliderEnabled: true,
|
||
|
onSliderChanged: (value) {
|
||
|
setState(() {
|
||
|
_sliderValue = value;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
MoodTextAreaWidget(
|
||
|
initialText: 'Sample Text',
|
||
|
isDisabled: !_isTextAreaEditable,
|
||
|
hasPrefix: false,
|
||
|
autoFocus: false,
|
||
|
forceBlinkingCursor: false,
|
||
|
),
|
||
|
ElevatedButton(
|
||
|
onPressed: _toggleTextAreaEditability,
|
||
|
child: Text(_isTextAreaEditable ? "- Save" : "+ Edit"),
|
||
|
),
|
||
|
SizedBox(height: 100), // Space for floating bottom navigation bar
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||
|
floatingActionButton: CustomBottomNavigationBar(initialSelectedIndex: 1),
|
||
|
);
|
||
|
}
|
||
|
}
|