home_page.dart 1.6 KB
Newer Older
1
import 'package:flutter/material.dart';
yenisleydi committed
2
import 'package:primer_practica/src/pages/category/lista_categorias.dart';
yenisleydi committed
3
import 'package:primer_practica/src/delegates/article_search_delegate.dart';
4 5

class HomePage extends StatelessWidget {
yenisleydi committed
6
  const HomePage({Key? key}) : super(key: key);
7 8 9 10

  @override
  Widget build(BuildContext context) {
    return Scaffold(
yenisleydi committed
11 12 13 14 15 16
      appBar: AppBar(
        title: const Text('Home'),
        backgroundColor: Colors.blue,
        actions: [
          IconButton(
            icon: const Icon(Icons.search),
yenisleydi committed
17
            onPressed: () {
yenisleydi committed
18 19 20 21
              showSearch(
                context: context,
                delegate: ArticleSearchDelegate(),
              );
yenisleydi committed
22 23 24
            },
          )
        ],
25
      ),
yenisleydi committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
      drawer: Drawer(
        child: ListView(
          padding: EdgeInsets.zero,
          children: [
            const DrawerHeader(
              decoration: BoxDecoration(
                color: Colors.blue,
              ),
              child: Text('Menu'),
            ),
            ListTile(
              title: const Text('Configuraciones'),
            ),
            ListTile(
              title: const Text('Ayuda'),
            ),
            ListTile(
              title: const Text('Exit'),
            ),
          ],
        ),
      ),
yenisleydi committed
48
      body: ListaCategorias(),
yenisleydi committed
49 50
      floatingActionButton: FloatingActionButton(
        onPressed: () {
yenisleydi committed
51
          Navigator.pushNamed(context, 'formulario');
yenisleydi committed
52 53 54 55 56
        },
        child: const Icon(Icons.add),
        tooltip: 'Agregar categoria',
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
57 58 59
    );
  }
}