Created
April 27, 2019 03:50
-
-
Save OmarSalah26/6f701e8f87965a61c7ef5d87347d1a2f to your computer and use it in GitHub Desktop.
simple flutter app
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:flutter/material.dart'; | |
main (){ | |
runApp(new materialApp(home: Home(), debugShowCheckedModeBanner: false),); | |
} | |
class Home extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
// TODO: implement createState | |
return new _Homestate(); | |
} | |
} | |
class _Homestate extends State<Home> { | |
String name = '', newstate=''; | |
int x = 0; | |
price (){ | |
setState(() { | |
newstate="air plan"; | |
}); | |
} | |
price2 (){ | |
setState(() { | |
newstate="bus "; | |
}); | |
} | |
void onclick(String text) { | |
setState(() { | |
name = text; | |
}); | |
} | |
void onclick2() { | |
setState(() { | |
name = "flatbutton"; | |
}); | |
} | |
onClick() { | |
setState(() { | |
print(x++); | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
floatingActionButton: FloatingActionButton( | |
onPressed: onClick, | |
child: Icon(Icons.add), | |
), | |
bottomNavigationBar: BottomNavigationBar( | |
items: [ | |
BottomNavigationBarItem( | |
icon: Icon(Icons.airplanemode_active), title: Text('airplan ')), | |
BottomNavigationBarItem( | |
icon: Icon(Icons.add), title: Text('addairplan ')), | |
], | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.lightGreenAccent, | |
), | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurpleAccent, | |
title: Text('flutter 002'), | |
textTheme: TextTheme(title: TextStyle(fontSize:25 )), | |
// automaticallyImplyLeading: bool.fromEnvironment("omas"), | |
// bottom: TabBar(tabs: null), | |
leading: Text('هلا بالعيال '), | |
actions: <Widget>[ | |
IconButton(icon: Icon(Icons.add_shopping_cart), onPressed: ()=>print("السلام عليكم ورحمة الله وبركاته "),) | |
], | |
), | |
body: Container( | |
padding: EdgeInsets.all(22.3), | |
child: Column( | |
children: <Widget>[ | |
Text("hallo $name "), | |
RaisedButton( | |
onPressed: () => onclick("this is parametert"), | |
child: Text('click me omar')), | |
Text("hallo $name "), | |
RaisedButton.icon( | |
onPressed: () => onclick("omarssssssssssssssssyhb"), | |
icon: Icon(Icons.alarm), | |
label: Text('thanks')), | |
FlatButton(onPressed: onclick2, child: Text('dddar')), | |
Text(" new state now is $newstate",style: TextStyle(fontSize: 40,color: Colors.deepPurpleAccent),), | |
Text(" سبحان الله $x",style: TextStyle(fontSize: 40,color: Colors.lightGreenAccent),), | |
IconButton( icon : Icon (Icons.all_inclusive), onPressed: price), | |
IconButton( icon : Icon (Icons.directions_bus), onPressed: price2) | |
], | |
), | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment