DiscoverModule/lib/main.dart

401 lines
14 KiB
Dart
Raw Normal View History

2024-08-19 08:44:44 +00:00
import 'package:discover_module/check.dart';
2024-07-05 08:48:29 +00:00
import 'package:discover_module/provider_class/affiliationsprovider.dart';
2024-08-13 10:46:26 +00:00
import 'package:discover_module/provider_class/engagement_provider.dart';
2024-07-05 08:48:29 +00:00
import 'package:discover_module/provider_class/events_provider.dart';
2024-06-27 08:38:43 +00:00
import 'package:discover_module/provider_class/hcp%20_provider.dart';
2024-07-24 08:23:02 +00:00
import 'package:discover_module/provider_class/medicalinsightprovider.dart';
2024-07-05 08:48:29 +00:00
import 'package:discover_module/provider_class/publications_provider.dart';
2024-06-27 08:38:43 +00:00
import 'package:discover_module/provider_class/single_hcpprovider.dart';
2024-08-13 10:46:26 +00:00
import 'package:discover_module/provider_class/speaker_provider.dart';
2024-07-05 08:48:29 +00:00
import 'package:discover_module/provider_class/trials_provider.dart';
2024-05-20 10:29:02 +00:00
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';
2024-07-24 08:23:02 +00:00
import 'package:discover_module/ui_screen/medical_insight.dart';
2024-07-05 08:48:29 +00:00
import 'package:discover_module/ui_screen/new_contacts.dart';
2024-05-20 10:29:02 +00:00
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');
2024-06-10 11:11:00 +00:00
await Hive.openBox('checkvalue');
2024-06-27 08:38:43 +00:00
await Hive.openBox('hcpdata');
2024-05-20 10:29:02 +00:00
runApp(MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => InteractionProvider()),
ChangeNotifierProvider(create: (_) => ViewInteractionProvider()),
2024-06-27 08:38:43 +00:00
ChangeNotifierProvider(create: (_) => hcpProvider()),
ChangeNotifierProvider(create: (_) => Singlehcpdetails()),
2024-07-05 08:48:29 +00:00
ChangeNotifierProvider(create: (_) => AffiliationsProvider()),
ChangeNotifierProvider(create: (_) => PublicatioProvider()),
ChangeNotifierProvider(create: (_) => EventProvider()),
ChangeNotifierProvider(create: (_) => TrialsProvider()),
2024-07-24 08:23:02 +00:00
ChangeNotifierProvider(create: (_) => MediacalInsightProvider()),
2024-08-13 10:46:26 +00:00
ChangeNotifierProvider(create: (_) => SpekerEvalutionProvider()),
ChangeNotifierProvider(create: (_) => EnagagementProvider()),
2024-05-20 10:29:02 +00:00
//ChangeNotifierProvider(create: (_) => ConfigDataProvider()),
ChangeNotifierProvider<HiveDataRepository>(
create: (_) => HiveDataRepository(
Hive.box<InteractionConfigData>('InteractionConfigDataBox'))),
],
child: MyApp(),
2024-08-19 08:44:44 +00:00
// child: MaterialApp(
// home: MyHomePage11(),
// ),
2024-05-20 10:29:02 +00:00
));
}
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.
2024-06-24 11:36:09 +00:00
2024-05-20 10:29:02 +00:00
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
2024-08-13 10:46:26 +00:00
// theme: ThemeData(
// fontFamily: 'SourceSerif',
// appBarTheme: const AppBarTheme(
// backgroundColor: Color.fromARGB(255, 0, 71, 132),
// foregroundColor: Colors.white //here you can give the text color
// )),
2024-05-20 10:29:02 +00:00
theme: ThemeData(
2024-08-13 10:46:26 +00:00
fontFamily: 'OpenSans',
2024-05-20 10:29:02 +00:00
appBarTheme: const AppBarTheme(
backgroundColor: Color.fromARGB(255, 0, 71, 132),
foregroundColor: Colors.white //here you can give the text color
)),
2024-07-26 07:17:34 +00:00
home: Contacts1(),
// home: const MyHomePage(title: 'Discover Module'),
2024-07-24 08:23:02 +00:00
// home: const MedicalInsight(),
2024-05-20 10:29:02 +00:00
);
}
}
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(
2024-07-12 08:40:20 +00:00
length: 1,
2024-05-20 10:29:02 +00:00
child: Scaffold(
drawerEnableOpenDragGesture: false, // Prevent user sliding open
appBar: AppBar(
automaticallyImplyLeading: false,
title: SvgPicture.asset(
'assets/konectar_white_logo.svg',
width: 100.0,
2024-05-20 12:48:15 +00:00
// color: Colors.white,
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
2024-05-20 10:29:02 +00:00
),
2024-05-21 08:40:44 +00:00
centerTitle: false,
2024-05-20 10:29:02 +00:00
bottom: const TabBar(
indicatorColor: Colors.white,
labelColor: Colors.white,
unselectedLabelColor: Colors.grey,
tabs: [
Tab(
2024-07-12 08:40:20 +00:00
text: '',
2024-05-20 10:29:02 +00:00
),
2024-07-12 08:40:20 +00:00
// Tab(
// text: 'Discover',
// ),
// Tab(
// text: 'HCP Report',
// ),
2024-05-20 10:29:02 +00:00
],
),
),
// endDrawer: MyWidget1(),
endDrawer: Drawer(
width: MediaQuery.of(context).size.width * 99.2,
child: Filters(),
),
body: TabBarView(
children: [
2024-07-05 08:48:29 +00:00
Center(child: const Contacts1()),
2024-07-12 08:40:20 +00:00
// Center(child: Discover(outerTabValue)),
// Center(child: DataTableDemo()),
2024-05-20 10:29:02 +00:00
],
// This trailing comma makes auto-formatting nicer for build methods.
),
),
),
);
}
}
2024-06-10 11:11:00 +00:00
2024-08-13 10:46:26 +00:00
// import 'package:flutter/material.dart';
// void main() {
// runApp(MyApp());
// }
// class MyApp extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: Scaffold(
// appBar: AppBar(title: Text('GridView Example')),
// body: Padding(
// padding: EdgeInsets.all(8.0),
// child: GridView.count(
// crossAxisCount: 2,
// crossAxisSpacing: 8.0,
// mainAxisSpacing: 8.0,
// shrinkWrap: true, // Make GridView as small as possible
// children: List.generate(10, (index) {
// return SizedBox(
// // height: 200, // Fixed height for each card
// child: Card(
// child: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text('Item $index'),
// Text('Item $index'),
// Text('Item $index'),
// Text('Item $index'),
// Text('Item $index'),
// Text('Item $index'),
// Text('Item $index'),
// ],
// ),
// ),
// ),
// );
// }),
// ),
// ),
// ),
// );
// }
// }
2024-08-19 08:44:44 +00:00
// import 'package:flutter/material.dart';
// void main() {
// runApp(MyApp());
// }
// class MyApp extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// title: 'Dynamic App Bar',
// theme: ThemeData(
// primarySwatch: Colors.blue,
// ),
// home: DynamicAppBar(),
// );
// }
// }
// class DynamicAppBar extends StatefulWidget {
// @override
// _DynamicAppBarState createState() => _DynamicAppBarState();
// }
// class _DynamicAppBarState extends State<DynamicAppBar> {
// final ScrollController _scrollController = ScrollController();
// double _listHeight = 0.0; // Variable to store list height
// @override
// void initState() {
// super.initState();
// _scrollController.addListener(() {
// // Check if the list has changed and update the height if necessary
// if (_scrollController.hasClients) {
// // Trigger rebuild to recalculate height
// WidgetsBinding.instance?.addPostFrameCallback((_) {
// final double newHeight = _scrollController.position.maxScrollExtent;
// if (newHeight != _listHeight) {
// setState(() {
// _listHeight = newHeight;
// });
// }
// });
// }
// });
// }
// @override
// Widget build(BuildContext context) {
// final double appBarHeight = 250.0; // Default height for the app bar
// final double adjustedHeight = _listHeight > 500.0
// ? appBarHeight
// : appBarHeight - 50.0; // Adjust height based on list size
// return Scaffold(
// body: CustomScrollView(
// controller: _scrollController,
// slivers: <Widget>[
// SliverAppBar(
// expandedHeight: adjustedHeight,
// flexibleSpace: FlexibleSpaceBar(
// centerTitle: true,
// collapseMode: CollapseMode.parallax,
// title: Text(
// 'Dynamic App Bar',
// style: TextStyle(
// color: Colors.white,
// fontSize:
// MediaQuery.of(context).size.width < 600 ? 16.0 : 22.0,
// ),
// ),
// background: ColoredBox(
// color: const Color.fromARGB(255, 246, 248, 252),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Padding(
// padding: EdgeInsets.all(8.0),
// child: Icon(
// Icons.person,
// size: MediaQuery.of(context).size.width < 600 ? 48 : 72,
// color: Colors.grey,
// ),
// ),
// Text(
// 'Dr. John Doe',
// style: TextStyle(
// fontSize: MediaQuery.of(context).size.width < 600
// ? 20.0
// : 28.0,
// fontWeight: FontWeight.bold,
// color: Colors.black,
// ),
// ),
// SizedBox(height: 8.0),
// Text(
// 'Specialist',
// style: TextStyle(
// fontSize: MediaQuery.of(context).size.width < 600
// ? 14.0
// : 18.0,
// color: Colors.black,
// ),
// ),
// ],
// ),
// ),
// ),
// floating: false,
// pinned: true,
// snap: false,
// ),
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) {
// return ListTile(
// title: Text('Item #$index'),
// );
// },
// //childCount: 50, // Number of items in the list
// ),
// ),
// ],
// ),
// );
// }
// }