2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Capture context data in the LocationDisplay widget

This commit is contained in:
Oliver Walters
2020-04-15 10:33:10 +10:00
parent 5ed13e69aa
commit 3fead77f6d
7 changed files with 42 additions and 56 deletions

View File

@ -22,6 +22,8 @@ import 'preferences.dart';
import 'package:InvenTree/inventree/part.dart';
void main() async {
// await PrefService.init(prefix: "inventree_");
@ -31,10 +33,10 @@ void main() async {
// Load login details
InvenTreePreferences().loadLoginDetails();
runApp(MyApp());
runApp(InvenTreeApp());
}
class MyApp extends StatelessWidget {
class InvenTreeApp extends StatelessWidget {
// This widget is the root of your application.
@override
@ -42,16 +44,8 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'InvenTree',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.lightGreen,
primarySwatch: Colors.lightBlue,
secondaryHeaderColor: Colors.blueGrey,
),
home: MyHomePage(title: 'InvenTree'),
);
@ -59,34 +53,6 @@ class MyApp extends StatelessWidget {
}
class ProductList extends StatelessWidget {
final List<InvenTreePart> _parts;
ProductList(this._parts);
Widget _buildPart(BuildContext context, int index) {
InvenTreePart part;
if (index < _parts.length) {
part = _parts[index];
}
return Card(
child: Column(
children: <Widget>[
Text('${part.name} - ${part.description}'),
]
)
);
}
@override
Widget build(BuildContext context) {
return ListView.builder(itemBuilder: _buildPart, itemCount: _parts.length);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);