Created
August 6, 2018 13:07
-
-
Save MeshkaniMohammad/fe22875dbb10623c39aabedb24229ad4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:image_picker/image_picker.dart'; | |
import 'package:flutter/material.dart'; | |
class Books extends StatefulWidget { | |
@override | |
_BooksState createState() => _BooksState(); | |
} | |
class _BooksState extends State<Books> { | |
File image; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, | |
floatingActionButton: FloatingActionButton( | |
backgroundColor: Colors.blueAccent, | |
child: ListTile( | |
trailing: Icon(Icons.add), | |
), | |
onPressed: _showAlertDialog), | |
bottomNavigationBar: BottomAppBar( | |
hasNotch: true, | |
child: Container( | |
color: Colors.blueAccent, | |
height: 50.0, | |
), | |
), | |
); | |
} | |
_showAlertDialog() { | |
var alert = new AlertDialog( | |
content: new Container( | |
color:Colors.red, | |
width: 50.0, | |
height: 50.0, | |
) | |
); | |
showDialog(context: context, | |
builder: (_){ | |
return alert; | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:firebase_example/Ui/Books.dart'; | |
import 'package:flutter/material.dart'; | |
class Home extends StatefulWidget { | |
@override | |
_HomeState createState() => _HomeState(); | |
} | |
class _HomeState extends State<Home> { | |
Icon actionIcon = new Icon(Icons.search); | |
Widget appBarTitle = new Text("کتاب فروشی آقای ایکس"); | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: AppBar( | |
title: appBarTitle, | |
centerTitle: true, | |
backgroundColor: Colors.blue, | |
actions: <Widget>[ | |
new IconButton( | |
icon: actionIcon, | |
onPressed: () { | |
setState(() { | |
if (this.actionIcon.icon == Icons.search) { | |
this.actionIcon = new Icon(Icons.close); | |
this.appBarTitle = new TextField( | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
decoration: new InputDecoration( | |
prefixIcon: new Icon(Icons.search, color: Colors.white), | |
hintText: "Search...", | |
hintStyle: new TextStyle(color: Colors.white)), | |
); | |
} else { | |
this.actionIcon = new Icon(Icons.search); | |
this.appBarTitle = new Text("AppBar Title"); | |
} | |
}); | |
}, | |
), | |
], | |
), | |
body: Books(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment