Skip to content

Instantly share code, notes, and snippets.

@iampawan
Created June 28, 2019 07:03
Show Gist options
  • Save iampawan/3ad6c4ddee26e0b2457e401a0a8fda94 to your computer and use it in GitHub Desktop.
Save iampawan/3ad6c4ddee26e0b2457e401a0a8fda94 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class AddDetails extends StatefulWidget {
final String place_id;
final String name;
AddDetails(this.place_id, this.name);
@override
_AddDetailsState createState() => _AddDetailsState();
}
class _AddDetailsState extends State<AddDetails> {
FocusNode myFocusNode;
TextEditingController _editingController = TextEditingController();
@override
void initState() {
super.initState();
myFocusNode = FocusNode();
}
@override
void dispose() {
myFocusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final bool showFab = MediaQuery.of(context).viewInsets.bottom == 0.0;
final bool showbtn = MediaQuery.of(context).viewInsets.bottom == 0.0;
return Scaffold(
body: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(myFocusNode);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(height: 20),
Text(
widget.name,
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
fontFamily: 'Pacifico'),
textAlign: TextAlign.center,
),
SizedBox(height: 5),
Text(
"Lets add some memories, excited?",
style: TextStyle(fontFamily: 'Montserrat'),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
focusNode: myFocusNode,
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Only best of the memories....',
hintStyle:
TextStyle(fontFamily: 'Dancing Script', fontSize: 22),
labelText: 'Description',
labelStyle:
TextStyle(fontFamily: 'Dancing Script', fontSize: 25),
),
// autofocus: true,
autocorrect: true,
controller: _editingController,
minLines: 1,
maxLines: 20,
scrollPadding: EdgeInsets.all(8),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
" Images Selected ",
textAlign: TextAlign.left,
),
SizedBox(
height: 5,
),
buildGridView()
],
),
),
),
// Center(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: showbtn
// ? FloatingActionButton.extended(
// heroTag: 'unique2',
// focusNode: myFocusNode,
// onPressed: () {
// final eSnackBar = SnackBar(
// content: Text("Add some text"),
// );
// final aSnackBar = SnackBar(
// content: Text("Added to memories successfully"),
// );
// _editingController.text.trim().isEmpty
// ? Scaffold.of(context).showSnackBar(eSnackBar)
// : Scaffold.of(context).showSnackBar(aSnackBar);
// },
// backgroundColor: _editingController.text.isNotEmpty
// ? Colors.green
// : Colors.grey,
// icon: Icon(Icons.done),
// label: Text('Add to memories'),
// elevation: 2,
// )
// : null,
// ),
// ),
],
),
),
floatingActionButton: Padding(
padding: const EdgeInsets.all(4.0),
child: showFab
? FloatingActionButton.extended(
heroTag: 'unique1',
label: Text('Add Images'),
icon: Icon(Icons.add),
onPressed: () {
// loadAssets();
},
elevation: 3,
backgroundColor: Colors.black,
focusNode: myFocusNode,
)
: null,
),
);
}
Widget buildGridView() {
return GridView.count(
shrinkWrap: true,
crossAxisCount: 2,
children: List.generate(5, (index) {
return SizedBox(
child: Text("data"),
width: 300,
height: 300,
);
}),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment