175 lines
6.0 KiB
Dart
175 lines
6.0 KiB
Dart
import 'package:discover_module/ui_screen/contacts.dart';
|
|
import 'package:discover_module/ui_screen/discover.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/model/interaction_config_data.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/model/json_form_data.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/repository/hive_repository.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/viewinteractionprovider.dart';
|
|
import 'package:discover_module/ui_screen/listview.dart';
|
|
import 'package:discover_module/ui_screen/filters_menu.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
// SystemChrome.setPreferredOrientations([
|
|
// DeviceOrientation.portraitUp,
|
|
// ]);
|
|
|
|
// WidgetsFlutterBinding.ensureInitialized();
|
|
// SystemChrome.setPreferredOrientations([
|
|
// DeviceOrientation.landscapeLeft,
|
|
// ]);
|
|
await Hive.initFlutter();
|
|
|
|
Hive.registerAdapter(SaveInteractionAdapter());
|
|
Hive.registerAdapter(InteractionConfigDataAdapter());
|
|
|
|
Hive.registerAdapter(InteractionResultDataAdapter());
|
|
Hive.registerAdapter(FormFieldDataAdapter());
|
|
Hive.registerAdapter(ValidationAdapter());
|
|
Hive.registerAdapter(SectionListAdapter());
|
|
Hive.registerAdapter(InputClassAdapter());
|
|
Hive.registerAdapter(InteractionWidgetAdapter());
|
|
|
|
// Hive.registerAdapter(UserDataAdapter());
|
|
Hive.registerAdapter(SendSaveJsonAdapter());
|
|
Hive.registerAdapter(MultipleSectionListAdapter());
|
|
Hive.registerAdapter(SaveAdapter());
|
|
Hive.registerAdapter(SaveInteractionFormJsonAdapter());
|
|
await Hive.openBox<SaveInteraction>('InteractionDataBox');
|
|
|
|
await Hive.openBox<InteractionConfigData>('InteractionConfigDataBox');
|
|
|
|
var box = await Hive.openBox('mycontact');
|
|
var box1 = await Hive.openBox('myfilter');
|
|
|
|
runApp(MultiProvider(
|
|
providers: [
|
|
ChangeNotifierProvider(create: (_) => InteractionProvider()),
|
|
ChangeNotifierProvider(create: (_) => ViewInteractionProvider()),
|
|
//ChangeNotifierProvider(create: (_) => ConfigDataProvider()),
|
|
ChangeNotifierProvider<HiveDataRepository>(
|
|
create: (_) => HiveDataRepository(
|
|
Hive.box<InteractionConfigData>('InteractionConfigDataBox'))),
|
|
],
|
|
child: MyApp(),
|
|
));
|
|
}
|
|
|
|
class MyApp extends StatefulWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
State<MyApp> createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
debugShowCheckedModeBanner: false,
|
|
title: 'Flutter Demo',
|
|
theme: ThemeData(
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color.fromARGB(255, 0, 71, 132),
|
|
foregroundColor: Colors.white //here you can give the text color
|
|
)),
|
|
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
// This widget is the home page of your application. It is stateful, meaning
|
|
// that it has a State object (defined below) that contains fields that affect
|
|
// how it looks.
|
|
|
|
// This class is the configuration for the state. It holds the values (in this
|
|
// case the title) provided by the parent (in this case the App widget) and
|
|
// used by the build method of the State. Fields in a Widget subclass are
|
|
// always marked "final".
|
|
|
|
final String title;
|
|
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
final String outerTabValue = 'value1';
|
|
|
|
late bool menuview = true;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// This method is rerun every time setState is called, for instance as done
|
|
// by the _incrementCounter method above.
|
|
//
|
|
// The Flutter framework has been optimized to make rerunning build methods
|
|
// fast, so that you can just rebuild anything that needs updating rather
|
|
// than having to individually change instances of widgets.
|
|
initState() {
|
|
menuview = true;
|
|
}
|
|
|
|
return Scaffold(
|
|
body: DefaultTabController(
|
|
length: 3,
|
|
child: Scaffold(
|
|
drawerEnableOpenDragGesture: false, // Prevent user sliding open
|
|
|
|
appBar: AppBar(
|
|
automaticallyImplyLeading: false,
|
|
title: SvgPicture.asset(
|
|
'assets/konectar_white_logo.svg',
|
|
width: 100.0,
|
|
// color: Colors.white,
|
|
colorFilter:
|
|
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
|
),
|
|
bottom: const TabBar(
|
|
indicatorColor: Colors.white,
|
|
labelColor: Colors.white,
|
|
unselectedLabelColor: Colors.grey,
|
|
tabs: [
|
|
Tab(
|
|
text: 'Contacts',
|
|
),
|
|
Tab(
|
|
text: 'Discover',
|
|
),
|
|
Tab(
|
|
text: 'HCP Report',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// endDrawer: MyWidget1(),
|
|
endDrawer: Drawer(
|
|
width: MediaQuery.of(context).size.width * 99.2,
|
|
child: Filters(),
|
|
),
|
|
|
|
body: TabBarView(
|
|
children: [
|
|
Center(child: Contacts()),
|
|
Center(child: Discover(outerTabValue)),
|
|
Center(child: DataTableDemo()),
|
|
],
|
|
// This trailing comma makes auto-formatting nicer for build methods.
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|