Search
 
SCRIPT & CODE EXAMPLE
 

DART

show shadow on focus input flutter

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))),
        ),
      ),
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: dart while loop 
Dart :: carousel in flutter curved images onpressed 
Dart :: flutter bool variable 
Dart :: dart array remove 
Dart :: dart list remove item by text 
Dart :: add all items to a list in dart 
Dart :: openining keyboard overflows pixels in flutter 
Dart :: parse int to string in flutter 
Dart :: skeleton container flutter 
Dart :: rounded button flutter 
Dart :: dart map values 
Dart :: dart set.generate 
Dart :: callback after last frame flutter 
Dart :: link failed but did not provide an info log flutter 
Dart :: Which one is performance wise better Text or extracted TextWidget function 
Dart :: <i class="fluigicon fluigicon-map-marker icon-xl"</i 
Dart :: extension methods in dart 
Dart :: dictionary in dart 
Dart :: how to show snackbar in initState() in flutter 
Dart :: convert to string flutter 
Swift :: swift ui text align center 
Swift :: swift change navigation bar color 
Swift :: remove child from firebase swift 
Swift :: how to make extension for optional in swift 
Swift :: swift set uiimage color 
Swift :: swift constraint center vertically 
Swift :: swiftui foreach 
Swift :: swift webview load html 
Swift :: ios swift create new background thread 
Swift :: loop backwards swift 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =