// Flutter code sample for BottomNavigationBar

//
// This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
// widget. The [BottomNavigationBar] has four [BottomNavigationBarItem]
// widgets, which means it defaults to [BottomNavigationBarType.shifting], and
// the [currentIndex] is set to index 0. The selected item is amber in color.
// With each [BottomNavigationBarItem] widget, backgroundColor property is
// also defined, which changes the background color of [BottomNavigationBar],
// when that item is selected. The `_onItemTapped` function changes the
// selected item's index and displays a corresponding message in the center of
// the [Scaffold].

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

/// This is the main application widget.
class MyApp extends StatelessWidget {
  const MyApp({Keykey}) : super(keykey);

  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title_title,
      homeMyStatefulWidget(),
    );
  }
}

/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
  const MyStatefulWidget({Keykey}) : super(keykey);

  @override
  State<MyStatefulWidgetcreateState() => _MyStatefulWidgetState();
}

class HomepageWidget extends StatelessWidget {
  static String routeName = '/';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title'App title',
      homeContainer(
        childText('Hello World'),
      ),
    );
  }
}

/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
  int _selectedIndex = 0;
  List _screens = [PageOne(), PageTwo()];
  static const TextStyle optionStyle =
      TextStyle(fontSize30fontWeightFontWeight.bold);

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBarAppBar(
        titleconst Text('BottomNavigationBar Sample'),
      ),
      body_screens[_selectedIndex],
      bottomNavigationBarBottomNavigationBar(
        itemsconst <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            iconIcon(Icons.home),
            label'Home',
            backgroundColorColors.red,
          ),
          BottomNavigationBarItem(
            iconIcon(Icons.business),
            label'Business',
            backgroundColorColors.green,
          ),
          BottomNavigationBarItem(
            iconIcon(Icons.school),
            label'School',
            backgroundColorColors.purple,
          ),
          BottomNavigationBarItem(
            iconIcon(Icons.settings),
            label'Settings',
            backgroundColorColors.pink,
          ),
        ],
        currentIndex_selectedIndex,
        selectedItemColorColors.amber[800],
        onTap_onItemTapped,
      ),
    );
  }
}

class PageOne extends StatelessWidget {
  final SnackBar _snackBar = SnackBar(
    contentconst Text('Message from page one'),
    durationconst Duration(seconds5),
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBarAppBar(
        backgroundColorColors.teal,
        titleText('Woolha.com - Page one'),
      ),
      bodyCenter(
        childColumn(
          mainAxisAlignmentMainAxisAlignment.center,
          crossAxisAlignmentCrossAxisAlignment.center,
          children: <Widget>[
            OutlinedButton(
              childText('Go to page two'),
              onPressed: () {
                Navigator.pushNamed(context'/two');
              },
            ),
            OutlinedButton(
              childText('Show message!'),
              onPressed: () {
                ScaffoldMessenger.of(context).showSnackBar(_snackBar);
              },
            ),
          ],
        ),
      ),
    );
  }
}

class PageTwo extends StatelessWidget {
  final SnackBar _snackBar = SnackBar(
    contentconst Text('Message from page two'),
    durationconst Duration(seconds5),
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBarAppBar(
        backgroundColorColors.teal,
        titleText('Woolha.com - Page Two'),
      ),
      bodyBuilder(builder: (BuildContext context) {
        return Center(
          childColumn(
            mainAxisAlignmentMainAxisAlignment.center,
            crossAxisAlignmentCrossAxisAlignment.center,
            children: <Widget>[
              OutlinedButton(
                childText('Go to page one'),
                onPressed: () {
                  Navigator.pop(context);
                },
              ),
              OutlinedButton(
                childText('Show message!'),
                onPressed: () {
                  ScaffoldMessenger.of(context).showSnackBar(_snackBar);
                },
              ),
            ],
          ),
        );
      }),
    );
  }
}


 


 class BaseViewSet(BaseModelViewSet):

    queryset = model.objects.all()

    serializer_class = modelSerializer

    http_method_names = ["get"]

    filterset_class = modelFilter


    def get_serializer_class(self):

        year = self.request.GET.get("year")

        if year:

            return yearSerializer

        return modelSerializer