Sorun
unknown
dart
3 years ago
3.2 kB
11
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(MyFoodApp());
}
class MyFoodApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text(
"BU GÜN NE YESEM",
style: TextStyle(
color: Colors.white,
),
),
centerTitle: true,
backgroundColor: Colors.orangeAccent,
),
body:
YemekSayfasi(),
),
color: Colors.red,
);
}
}
class YemekSayfasi extends StatefulWidget { @override
State<YemekSayfasi> createState() => _YemekSayfasiState();
}
class _YemekSayfasiState extends State<YemekSayfasi> {
@override
Widget build(BuildContext context) {
int yemekNo = 1;
int corbaNo = 2;
int tatliNo = 1;
return Center(
child: Column(
children: <Widget> [
Expanded(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: TextButton(
style: TextButton.styleFrom(
backgroundColor:
Colors.white,
foregroundColor:
Colors.black,
padding: EdgeInsets.all(20.0),
),
onPressed: () {
setState(() {
int corbaNo = 2;
corbaNo = 4;
});
},
child: Image.asset('images/corba_$corbaNo.jpg'),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.red,
/,
backgroundColor:
Colors.white,
),
onPressed: () {
setState(() {
yemekNo = 2;
print("Yemek No: $yemekNo");
});
},
child: Image.asset('images/yemek_$yemekNo.jpg'),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.red,
backgroundColor: Colors.white,
padding: EdgeInsets.all(20.0),
),
onPressed: () {
setState(() {
tatliNo = 3;
});
print("Tatlı No: $tatliNo");
},
child: Image.asset('images/tatli_$tatliNo.jpg'),
),
),
),
],
),
);
}
}
Editor is loading...