Created
March 7, 2019 12:17
-
-
Save angelabauer/1b8e0089c03f0e85e3f2eb1fa0aa68e2 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 'package:flutter/material.dart'; | |
void main() => runApp( | |
MaterialApp( | |
home: BallPage(), | |
), | |
); | |
class BallPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.blue, | |
appBar: AppBar( | |
backgroundColor: Colors.blue.shade900, | |
title: Text('Ask Me Anything'), | |
), | |
body: Container(), | |
); | |
} | |
} |
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: BallPage(),
),
);
class BallPage extends StatelessWidget {
const BallPage({super.key});
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue,
appBar: AppBar(
backgroundColor: Colors.blue.shade900,
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'Ask Me Anything',
style: TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.bold,
color: Colors.white,
//padding: EdgeInsets.all(20),
),
// color: Colors.blue,
),
],
)),
body: Center(
child: Container(),
));
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my code!!
import 'package:flutter/material.dart';
import 'dart:math';
void main() {
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.blue,
appBar: AppBar(
title: Text(
'Ask Me Anything',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
fontFamily: 'SourceCodePro'),
),
centerTitle: true,
backgroundColor: Colors.blue.shade900,
),
body: Ball())));
}
class Ball extends StatefulWidget {
const Ball({super.key});
@OverRide
State createState() => _BallState();
}
class _BallState extends State {
@OverRide
int Magicball = 1;
void randomAnswerGenerator() {
setState(() {
Magicball = Random().nextInt(5) + 1;
});
}
Widget build(BuildContext context) {
return TextButton(
onPressed: () {
randomAnswerGenerator();
},
child: Center(child: Image.asset('images/ball$Magicball.png')),
);
}
}
//
//