Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.9 kB
4
Indexable
Never
import 'package:flutter/material.dart';

void main() {
  runApp(const MyFoodApp());
}

class MyFoodApp extends StatelessWidget {
  const MyFoodApp({super.key});

  @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: const YemekSayfasi(),
      ),
      color: Colors.red,
    );
  }
}

class YemekSayfasi extends StatefulWidget {
  const YemekSayfasi({super.key});

  @override
  State<YemekSayfasi> createState() => _YemekSayfasiState();
}

class _YemekSayfasiState extends State<YemekSayfasi> {
  int yemekNo = 1;
  int corbaNo = 2;
  int tatliNo = 1;
  @override
  Widget build(BuildContext context) {
    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: const EdgeInsets.all(20.0),
                ),
                onPressed: () {
                  setState(() {
                    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: const EdgeInsets.all(20.0),
                ),
                onPressed: () {
                  setState(() {
                    tatliNo = 3;
                  });
                  print("Tatlı No: $tatliNo");
                },
                child: Image.asset('images/tatli_$tatliNo.jpg'),
              ),
            ),
          ),
        ],
      ),
    );
  }
}