Lesson 12

// Some code
import 'package:flutter/material.dart';

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

  @override
  State<Lesson13> createState() => _Lesson13State();
}

class _Lesson13State extends State<Lesson13> {
  double value = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.yellow,
        leading: GestureDetector(
          onTap: () {},
          child: Image.asset('assets/leaf.png'),
        ),
        title: Text('Hello'),
        centerTitle: true,
        actions: [
          ElevatedButton(
            onPressed: () {},
            child: Image.asset('assets/leaf.png', height: 5, width: 5),
          ),
        ],
      ),
      backgroundColor: Colors.yellow,
      body: Container(
        height: double.infinity,
        width: double.infinity,
        margin: EdgeInsets.only(top: 25),
        padding: EdgeInsets.only(top: 22, right: 33, left: 33),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(30),
            topRight: Radius.circular(30),
          ),
        ),
        child: Column(
          crossAxisAlignment: .start,
          children: [
            Row(
              //mainAxisAlignment: .spaceAround,
              children: [
                Text('Hello'),
                Spacer(),
                IconButton(onPressed: () {}, icon: Icon(Icons.remove_circle)),
                Text('1'),
                IconButton(onPressed: () {}, icon: Icon(Icons.add_circle)),
              ],
            ),
            GridView(
              shrinkWrap: true,
              physics: NeverScrollableScrollPhysics(),
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 5,
                childAspectRatio: 0.9,
              ),
              children: [
                Column(
                  mainAxisSize: .min,
                  children: [
                    Container(
                      height: 60,
                      width: 60,
                      color: Colors.yellow,
                      child: Image.asset('assets/leaf.png'),
                    ),
                    Text('Hello'),
                  ],
                ),
                Column(
                  mainAxisSize: .min,
                  children: [
                    Container(
                      height: 60,
                      width: 60,
                      color: Colors.yellow,
                      child: Image.asset('assets/leaf.png'),
                    ),
                    Text('Hello'),
                  ],
                ),
              ],
            ),
            Divider(),
            Text('Hello'),
            Row(
              children: [
                Text('hellpo'),
                IconButton(onPressed: () {}, icon: Icon(Icons.star)),
              ],
            ),
            Divider(),
            Text('categories'),
            GridView(
              shrinkWrap: true,
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3,
                childAspectRatio: 3,
                mainAxisSpacing: 5,
                crossAxisSpacing: 5
              ),
              children: [
                Container(color: Colors.yellow,),
                Container(color: Colors.yellow,),
                Container(color: Colors.yellow,),
                Container(color: Colors.yellow,),
              ],
            ),
            Divider(),
            Text('Price'),
            Slider(

                min: 0,
                max: 100,
                activeColor: Colors.orange,
                inactiveColor: Colors.grey,
                //secondaryActiveColor: Colors.pink,
                value: value, onChanged: (data){
              setState(() {
                value = data;
              });
            }),
            Row(
              mainAxisAlignment: .spaceBetween,
              children: [
                Text('\$1'),
                Text('\$1'),
                Text('\$1'),
                Text('\$1'),
              ],
            ),
            Row(
              children: [
                Text('Texty'),
                Spacer(),
                Text('\$40'),
                Radio(value: true),
              ],
            )
          ],
        ),
      ),
    );
  }
}

Last updated