Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update#5 #7

Merged
merged 2 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/pics/Flappy-Bird-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pics/background-night.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pics/bluebird.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pics/redbird.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion lib/Ui/Bird.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@

import 'package:flutter/material.dart';

import '../constant/constant.dart';

class Bird extends StatelessWidget {
final double yAxis;
final double birdWidth;
final double birdHeight;

Bird(this.yAxis, this.birdWidth, this.birdHeight);
String setbird(){
if(c==Colors.yellow){
return"assets/pics/bird.png";
}
else if(c==Colors.blue){
return"assets/pics/bluebird.png";
}
else
return"assets/pics/redbird.png";
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return AnimatedContainer(
alignment: Alignment(0, (2 * yAxis + birdHeight) / (2- birdHeight)),
duration: Duration(milliseconds: 0),
child: Image.asset(
"assets/pics/bird.png",
setbird(),
width: size.width * birdWidth,
height: size.height * birdHeight,
fit: BoxFit.cover,
Expand Down
9 changes: 8 additions & 1 deletion lib/Ui/HomePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ class HomePage extends StatefulWidget {
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
String settheme(){
if(theme ==true){
return"assets/pics/background-day.png";
}
else
return"assets/pics/background-night.png";
}
@override
Widget build(BuildContext context) {
return GestureDetector(
Expand All @@ -26,7 +33,7 @@ class _HomePageState extends State<HomePage> {
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/pics/background-day.png"),
image: AssetImage(settheme()),
fit: BoxFit.cover)),
child: Stack(
children: [
Expand Down
146 changes: 146 additions & 0 deletions lib/Ui/Settings.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import 'package:flutter/material.dart';
import 'package:flutter_switch/flutter_switch.dart';

import '../constant/constant.dart';



class Settings extends StatefulWidget {
const Settings({Key? key}) : super(key: key);

@override
State<Settings> createState() => _SettingsState();
}

class _SettingsState extends State<Settings> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Container(
width: 250,
height: 200,
child: Row(
children: [
Text("THEME ", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),),
FlutterSwitch(
width: 125.0,
height: 55.0,
valueFontSize: 25.0,
toggleSize: 45.0,
value: theme,
borderRadius: 30.0,
padding: 8.0,
showOnOff: true,
onToggle: (val) {
setState(() {
theme = val;
});
},
),
Container(
width: 50,
),

],
),

),
Row(
children: [
Text("Characters" , style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),),
IconButton(
onPressed: (){
setState(() {
c =Colors.yellow ;
});
},
icon:Image.asset(
"assets/pics/bird.png"),
iconSize: 100,),
IconButton(
onPressed: (){
setState(() {
c =Colors.blue ;
});
},
icon:Image.asset(
"assets/pics/bluebird.png"),
iconSize: 100,),
IconButton(
onPressed: (){
setState(() {
c =Colors.red ;
});
},
icon:Image.asset(
"assets/pics/redbird.png"),
iconSize: 100,)
],
),
Row(
children: [
Text("Difficulity", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),),
ButtonBar(

children: [
ElevatedButton(onPressed: (){
setState(() {
velocity=1.0;
});
}, child: Text("EASY"),
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Colors.blueGrey,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: Colors.blueGrey)
)

),

),
ElevatedButton(onPressed: (){
setState(() {
velocity=2.5;
});
}, child: Text("MEDIUM"),
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Colors.blueGrey,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: Colors.blueGrey)
)

),

),
ElevatedButton(onPressed: (){
setState(() {
velocity=3.0;
});
}, child: Text("HARD"),
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Colors.blueGrey,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: Colors.blueGrey)
)

),

),
],
)
],
)

],
),
);
}
}

Loading