1
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
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});
|
||||
@@ -10,6 +14,19 @@ class PlanFormCard extends StatefulWidget {
|
||||
class _PlanFormCardState extends State<PlanFormCard> {
|
||||
final TextEditingController _inputController = TextEditingController();
|
||||
|
||||
void _handSubmit() {
|
||||
if (_inputController.text.isEmpty) {
|
||||
return;
|
||||
}
|
||||
context.push(
|
||||
RoutePaths.planDetail(),
|
||||
extra: {
|
||||
"name": _inputController.text,
|
||||
},
|
||||
);
|
||||
_inputController.clear();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
@@ -26,20 +43,7 @@ class _PlanFormCardState extends State<PlanFormCard> {
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 40),
|
||||
margin: EdgeInsets.only(top: 120),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black, width: 2),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0xffb5b5b5),
|
||||
blurRadius: 2,
|
||||
offset: Offset(6, 6),
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.normal,
|
||||
),
|
||||
],
|
||||
),
|
||||
decoration: shadowDecoration,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
@@ -49,6 +53,7 @@ class _PlanFormCardState extends State<PlanFormCard> {
|
||||
TextField(
|
||||
controller: _inputController,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
maxLength: 40,
|
||||
decoration: InputDecoration(
|
||||
hintText: "我躺在床上听歌",
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||
@@ -68,19 +73,22 @@ class _PlanFormCardState extends State<PlanFormCard> {
|
||||
),
|
||||
),
|
||||
),
|
||||
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(
|
||||
"创建计划",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
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(
|
||||
"创建计划",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user