Files
plan_flutter/lib/page/home/widget/plan_form_card.dart
zhutao 3df6e3d49e 1
2025-09-09 17:57:02 +08:00

105 lines
3.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:plan/theme/decorations/app_shadows.dart';
import '../../../router/config/route_paths.dart';
class PlanFormCard extends StatefulWidget {
const PlanFormCard({super.key});
@override
State<PlanFormCard> createState() => _PlanFormCardState();
}
class _PlanFormCardState extends State<PlanFormCard> {
final TextEditingController _inputController = TextEditingController(text: "");
void _handSubmit() {
if (_inputController.text.isEmpty) {
return;
}
context.push(
RoutePaths.planDetail(0),
extra: {
"name": _inputController.text,
},
);
_inputController.clear();
}
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.topCenter,
children: [
Positioned(
top: 56,
child: SizedBox(
height: 100,
child: Image.asset("assets/image/kbn.png"),
),
),
Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 40),
margin: EdgeInsets.only(top: 120),
decoration: shadowDecoration,
child: Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 20),
child: Text("What have you been putting off?"),
),
TextField(
controller: _inputController,
style: Theme.of(context).textTheme.bodyMedium,
maxLength: 40,
maxLines: 5,
minLines: 1,
expands: false,
decoration: InputDecoration(
hintText: "Just finished eating and l'm gonna go wash the dishes",
fillColor: Theme.of(context).colorScheme.surfaceContainerLow,
filled: true,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: Theme.of(context).colorScheme.surfaceContainerHigh,
),
borderRadius: BorderRadius.circular(5),
),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
),
borderRadius: BorderRadius.circular(5),
),
),
),
InkWell(
onTap: _handSubmit,
child: Container(
margin: EdgeInsets.only(top: 20),
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.black, width: 1.5),
),
child: Text(
"Create Plan",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
),
],
),
),
],
);
}
}