Pokaż cień na futrze wejściowej
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(),
body: Home(),
),
);
}
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
static GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
FocusNode focusNode;
@override
void initState() {
super.initState();
focusNode = FocusNode();
focusNode.addListener(() => setState(() {}));
}
@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: Duration(seconds: 5),
margin: const EdgeInsets.all(16),
decoration: focusNode.hasFocus ? BoxDecoration(boxShadow: [BoxShadow(blurRadius: 6)]) : null,
child: Form(
key: _formKey,
child: TextFormField(
focusNode: focusNode,
decoration: InputDecoration(
fillColor: Colors.white,
hoverColor: Colors.white,
filled: true,
enabledBorder: OutlineInputBorder(borderSide: BorderSide.none),
focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey, width: 1))),
),
),
);
}
}
Kami