generic_form_field 0.1.3+0 generic_form_field: ^0.1.3+0 copied to clipboard
form fields for a real world plugin project, search and select, dropdown.
import 'package:flutter/material.dart';
import 'pages/users.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
int _selectedIndex = 0;
Widget _body() {
Widget w;
switch (_selectedIndex) {
case 0:
w = Center(child: Text(''));
break;
default:
w = Users();
}
return w;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text('Generic form field example app'),
),
body: _body(),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
),
BottomNavigationBarItem(
icon: Icon(Icons.group),
title: Text('Users'),
)
],
currentIndex: _selectedIndex,
onTap: (i) => setState(() => _selectedIndex = i),
),
),
);
}
}