Suggested changes S

This commit is contained in:
poojakhatawate 2024-05-21 14:10:44 +05:30
parent 1dc802b0cb
commit 2d3dcfa022
14 changed files with 816 additions and 625 deletions

5
lib/constants.dart Normal file
View File

@ -0,0 +1,5 @@
import 'dart:ui';
class Constants {
static Color k2color = Color.fromARGB(255, 0, 71, 132);
}

View File

@ -2,7 +2,8 @@ import 'package:discover_module/custom_widget/text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class Alert extends StatefulWidget { class Alert extends StatefulWidget {
const Alert({super.key}); Alert({super.key, required this.data});
String? data;
@override @override
State<Alert> createState() => _AlertState(); State<Alert> createState() => _AlertState();
@ -17,7 +18,7 @@ class _AlertState extends State<Alert> {
txtfont: 22.0, txtfont: 22.0,
), ),
content: Text1( content: Text1(
title: "User Added Successfully", title: widget.data!,
txtfont: 18.0, txtfont: 18.0,
), ),
actions: [ actions: [

View File

@ -81,7 +81,7 @@ class _MyAppState extends State<MyApp> {
backgroundColor: Color.fromARGB(255, 0, 71, 132), backgroundColor: Color.fromARGB(255, 0, 71, 132),
foregroundColor: Colors.white //here you can give the text color foregroundColor: Colors.white //here you can give the text color
)), )),
home: const MyHomePage(title: 'Flutter Demo Home Page'), home: const MyHomePage(title: 'Discover Module'),
); );
} }
} }
@ -136,6 +136,7 @@ class _MyHomePageState extends State<MyHomePage> {
colorFilter: colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn), const ColorFilter.mode(Colors.white, BlendMode.srcIn),
), ),
centerTitle: false,
bottom: const TabBar( bottom: const TabBar(
indicatorColor: Colors.white, indicatorColor: Colors.white,
labelColor: Colors.white, labelColor: Colors.white,

11
lib/textScalar.dart Normal file
View File

@ -0,0 +1,11 @@
import 'dart:math';
import 'package:flutter/material.dart';
class ScaleSize {
static double textScaleFactor(BuildContext context,
{double maxTextScaleFactor = 2}) {
final width = MediaQuery.of(context).size.width;
double val = (width / 1400) * maxTextScaleFactor;
return max(1, min(val, maxTextScaleFactor));
}
}

View File

@ -1,4 +1,5 @@
import 'package:discover_module/custom_widget/elevation_btn.dart'; import 'package:discover_module/custom_widget/elevation_btn.dart';
import 'package:discover_module/custom_widget/show_alert.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
@ -34,179 +35,180 @@ class _FiltersState extends State<Filters> {
checkwidth = MediaQuery.of(context).size.width * 0.95; checkwidth = MediaQuery.of(context).size.width * 0.95;
} }
return GestureDetector( return ListView(
onTap: () => FocusScope.of(context).unfocus(), children: <Widget>[
child: ListView( // DrawerHeader removed
children: <Widget>[ ListTile(
// DrawerHeader removed title: Padding(
ListTile( padding: const EdgeInsets.all(8.0),
title: Padding( child: Row(
padding: const EdgeInsets.all(8.0), mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, const Icon(
children: [ Icons.filter_alt,
const Icon( size: 30.0,
Icons.filter_alt, ),
size: 30.0, const Text(
), "Filters",
const Text( style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
"Filters", ),
style: GestureDetector(
TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), onTap: () {
), Navigator.pop(context);
GestureDetector( // print("hiii");
onTap: () { },
Navigator.pop(context); child: const Icon(Icons.cancel))
// print("hiii"); ],
},
child: const Icon(Icons.cancel))
],
),
), ),
), ),
),
ListTile( ListTile(
title: Container( title: Container(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey),
),
child: DropdownButtonFormField<String>(
decoration: const InputDecoration.collapsed(hintText: ''),
value: _selectedItem,
onChanged: (String? value) {
setState(() {
_selectedItem = value;
});
},
items: <String>[
'Ivoclar EU Staging',
'Cardiology',
'CYTK_EU',
'Otolaryngology'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
hint: const Text('Select an Project Scope'),
isExpanded: true,
),
),
),
ListTile(
title: TextField(
controller: txt1,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
),
labelText: 'Keyword',
isDense: false,
contentPadding: const EdgeInsets.all(3),
),
),
),
ListTile(
title: TextField(
controller: txt2,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
),
labelText: 'Drugs',
isDense: false,
contentPadding: const EdgeInsets.all(3), // Added this
),
),
),
ListTile(
title: Padding(
padding: const EdgeInsets.all(0.0),
child: Container(
padding: const EdgeInsets.all(9.0),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey), border: Border.all(color: Colors.grey),
), ),
child: DropdownButtonFormField<String>( child: DropdownButtonFormField<String>(
decoration: const InputDecoration.collapsed(hintText: ''), decoration: const InputDecoration.collapsed(hintText: ''),
value: _selectedItem, value: _selectedItem1,
onChanged: (String? value) { onChanged: (String? value) {
setState(() { setState(() {
_selectedItem = value; _selectedItem1 = value;
}); });
}, },
items: <String>[ items: <String>['Tag', 'Specialities', 'Country', 'Region']
'Ivoclar EU Staging', .map<DropdownMenuItem<String>>((String value) {
'Cardiology',
'CYTK_EU',
'Otolaryngology'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value),
); );
}).toList(), }).toList(),
hint: const Text('Select an Project Scope'), hint: const Text('Select an Filter'),
isExpanded: true, isExpanded: true,
), ),
), ),
), ),
ListTile( ),
title: TextField( ListTile(
controller: txt1, title: SizedBox(
decoration: InputDecoration( width: checkwidth,
prefixIcon: const Icon(Icons.search), child: DropdownMenu(
border: OutlineInputBorder( // width: MediaQuery.of(context).size.width * 0.95,
borderRadius: BorderRadius.circular(10.0), // width: MediaQuery.of(context).size.width * 0.90,
),
labelText: 'Keyword',
isDense: false,
contentPadding: const EdgeInsets.all(3),
),
),
),
ListTile(
title: TextField(
controller: txt2,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
),
labelText: 'Drugs',
isDense: false,
contentPadding: const EdgeInsets.all(3), // Added this
),
),
),
ListTile(
title: Padding(
padding: const EdgeInsets.all(0.0),
child: Container(
padding: const EdgeInsets.all(9.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey),
),
child: DropdownButtonFormField<String>(
decoration: const InputDecoration.collapsed(hintText: ''),
value: _selectedItem1,
onChanged: (String? value) {
setState(() {
_selectedItem1 = value;
});
},
items: <String>['Tag', 'Specialities', 'Country', 'Region']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
hint: const Text('Select an Filter'),
isExpanded: true,
),
),
),
),
ListTile(
title: SizedBox(
width: checkwidth, width: checkwidth,
child: DropdownMenu(
// width: MediaQuery.of(context).size.width * 0.95,
// width: MediaQuery.of(context).size.width * 0.90,
width: checkwidth,
// width: 340.0, // width: 340.0,
requestFocusOnTap: true, requestFocusOnTap: true,
hintText: "Select text", hintText: "Select text",
enableFilter: true, enableFilter: true,
onSelected: (color) { onSelected: (color) {
if (color != null) { if (color != null) {
setState(() { setState(() {
// _themeColor =color; // _themeColor =color;
}); });
} }
}, },
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
isDense: false, isDense: false,
contentPadding: const EdgeInsets.symmetric(horizontal: 10), contentPadding: const EdgeInsets.symmetric(horizontal: 10),
constraints: BoxConstraints.tight(const Size.fromHeight(45)), constraints: BoxConstraints.tight(const Size.fromHeight(45)),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
),
), ),
// ignore: prefer_const_literals_to_create_immutables
dropdownMenuEntries: <DropdownMenuEntry<Color>>[
const DropdownMenuEntry(
value: Colors.white, label: 'Cardiovascular Disease'),
const DropdownMenuEntry(
value: Colors.red, label: 'Interventional Cardiology'),
const DropdownMenuEntry(
value: Colors.pinkAccent, label: 'Oncology'),
],
), ),
// ignore: prefer_const_literals_to_create_immutables
dropdownMenuEntries: <DropdownMenuEntry<Color>>[
const DropdownMenuEntry(
value: Colors.white, label: 'Cardiovascular Disease'),
const DropdownMenuEntry(
value: Colors.red, label: 'Interventional Cardiology'),
const DropdownMenuEntry(
value: Colors.pinkAccent, label: 'Oncology'),
],
), ),
), ),
),
ListTile( ListTile(
title: Padding( title: Padding(
padding: const EdgeInsets.only(left: 40.0, right: 40.0), padding: const EdgeInsets.only(left: 40.0, right: 40.0),
child: ElevationBtn( child: ElevationBtn(
onPressed: () { onPressed: () {
print(_selectedItem); print(_selectedItem);
print(_selectedItem1); print(_selectedItem1);
print(selectedColor); print(selectedColor);
print("Txt1 : ${txt1.text}"); print("Txt1 : ${txt1.text}");
print("Txt2 ${txt2.text}"); print("Txt2 ${txt2.text}");
// Respond to button press // Respond to button press
if (_selectedItem != null ||
selectedColor != null ||
txt1.text.isNotEmpty ||
txt2.text.isNotEmpty) {
HiveFunctions1.createUser({ HiveFunctions1.createUser({
"name": _selectedItem, "name": _selectedItem,
"name1": _selectedItem1, "name1": _selectedItem1,
@ -218,50 +220,56 @@ class _FiltersState extends State<Filters> {
setState(() { setState(() {
shouldDisplay = !shouldDisplay; shouldDisplay = !shouldDisplay;
}); });
}, } else {
text: "ADD", print("Iam else");
color: Color.fromARGB(255, 0, 71, 132),
textcolor: Colors.white, showDialog(
), context: context,
builder: (_) {
return Alert(data: "Please select the Filter");
});
}
},
text: "ADD",
color: const Color.fromARGB(255, 0, 71, 132),
textcolor: Colors.white,
), ),
), ),
),
Expanded( ListView.builder(
child: ListView.builder( shrinkWrap: true,
shrinkWrap: true, itemCount: HiveFunctions1.getAllUsers().length,
itemCount: HiveFunctions1.getAllUsers().length, itemBuilder: (BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) { var data = HiveFunctions1.getAllUsers()[index];
var data = HiveFunctions1.getAllUsers()[index];
// return Text("Data_isssss: ${data["name"]}"); // return Text("Data_isssss: ${data["name"]}");
return ListTile( return ListTile(
title: Center( title: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(data["name"], child: Text(data["name"],
style: const TextStyle( style: const TextStyle(
fontSize: 21.0, fontWeight: FontWeight.bold)), fontSize: 21.0, fontWeight: FontWeight.bold)),
), ),
), ),
subtitle: Column( subtitle: Column(
children: [ children: [
Text(data["name1"], Text(data["name1"],
style: const TextStyle( style: const TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold)), fontSize: 18.0, fontWeight: FontWeight.bold)),
Text(data["name2"], Text(data["name2"],
style: const TextStyle( style: const TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold)), fontSize: 18.0, fontWeight: FontWeight.bold)),
Text(data["name3"], Text(data["name3"],
style: const TextStyle( style: const TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold)), fontSize: 18.0, fontWeight: FontWeight.bold)),
], ],
), ),
); );
}), }),
), ],
],
),
); );
} }
} }

View File

@ -1,6 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:discover_module/constants.dart';
import 'package:discover_module/textScalar.dart';
import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart'; import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
import 'package:discover_module/ui_screen/interactionform/util.dart'; import 'package:discover_module/ui_screen/interactionform/util.dart';
@ -110,7 +112,7 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
style: TextStyle( style: TextStyle(
fontSize: isTablet ? 22 : 14, color: Colors.white), fontSize: isTablet ? 22 : 14, color: Colors.white),
), ),
backgroundColor: const Color(0xFF2b9af3), // backgroundColor: const Color(0xFF2b9af3),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
actions: [saveActions(provider)], actions: [saveActions(provider)],
leading: InkWell( leading: InkWell(
@ -149,9 +151,9 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
// height: double.infinity, // height: double.infinity,
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF2b9af3), // color: Color(0xFF2b9af3),
), color: Constants.k2color),
child: Text( child: Text(
item.sectionName, item.sectionName,
style: const TextStyle( style: const TextStyle(
@ -199,14 +201,24 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
child: GridView.count( child: GridView.count(
physics: physics:
const NeverScrollableScrollPhysics(), const NeverScrollableScrollPhysics(),
// crossAxisCount:
// context.responsive<int>(
// 1,
// sm: 1, // small
// md: 1, // medium
// lg: sectionList.length == 1
// ? 1
// : 4, // large
// xl: 3, // extra large screen
// ),
crossAxisCount: crossAxisCount:
context.responsive<int>( context.responsive<int>(
1, 1,
sm: 1, // small sm: 1, // small
md: 1, // medium md: 2, // medium
lg: sectionList.length == 1 lg: sectionList.length == 1
? 1 ? 1
: 4, // large : 3, // large
xl: 3, // extra large screen xl: 3, // extra large screen
), ),
mainAxisSpacing: mainAxisSpacing:
@ -216,14 +228,24 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
: 3.5, : 3.5,
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
// childAspectRatio:
// sectionList.length == 1 ||
// !isTablet
// ? orientation ==
// Orientation.landscape
// ? 10
// : 3.8
// : 2.4,
childAspectRatio: childAspectRatio:
sectionList.length == 1 || sectionList.length == 1
!isTablet
? orientation == ? orientation ==
Orientation.landscape Orientation.landscape
? 10 ? 10
: 3.8 : 4.8
: 2.4, : isTablet
? 3.6
: 3.0,
children: List.generate( children: List.generate(
sectionList.length, sectionList.length,
(i) { (i) {
@ -443,20 +465,27 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
}, },
), ),
) )
: SizedBox( : Expanded(
width: isTablet ? 200 : MediaQuery.of(context).size.width, child: Padding(
height: isTablet ? 50 : 40, padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: InteractionTextField( child: SizedBox(
maxchars: int.parse(sectionItem.chars ?? "0"), // width: isTablet ? 200 : MediaQuery.of(context).size.width,
controller: sectionItem.controller!, width: MediaQuery.of(context).size.width,
inputType: sectionItem.input == "number"
? TextInputType.number height: isTablet ? 50 : 40,
: TextInputType.name, child: InteractionTextField(
labelText: sectionItem.name, maxchars: int.parse(sectionItem.chars ?? "0"),
onChanged: (val) { controller: sectionItem.controller!,
sectionItem.selectedValue = []; inputType: sectionItem.input == "number"
provider.setTextValue(val, sectionItem, multiple); ? TextInputType.number
}, : TextInputType.name,
labelText: sectionItem.name,
onChanged: (val) {
sectionItem.selectedValue = [];
provider.setTextValue(val, sectionItem, multiple);
},
),
),
), ),
); );
case InteractionWidget.DROPDOWN: case InteractionWidget.DROPDOWN:
@ -466,7 +495,9 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
Widget buildDateWidget(SectionList sectionItem) { Widget buildDateWidget(SectionList sectionItem) {
return SizedBox( return SizedBox(
width: isTablet ? 200 : MediaQuery.of(context).size.width, // width: isTablet ? 200 : MediaQuery.of(context).size.width,
width: MediaQuery.of(context).size.width,
height: isTablet ? 50 : 40, height: isTablet ? 50 : 40,
child: TextField( child: TextField(
controller: controller:
@ -546,59 +577,69 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
List<InputClass> list = provider.getData2(sectionItem); List<InputClass> list = provider.getData2(sectionItem);
// .map((itemWord) => InputClass.fromJson(itemWord)) // .map((itemWord) => InputClass.fromJson(itemWord))
// .toList(); // .toList();
return SizedBox( return Padding(
width: isTablet ? 250 : MediaQuery.of(context).size.width, padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Row( child: SizedBox(
children: <Widget>[ // width: isTablet ? 250 : MediaQuery.of(context).size.width,
for (InputClass value in list) width: MediaQuery.of(context).size.width,
Row(
children: [ child: Row(
Radio( children: <Widget>[
value: value.name, for (InputClass value in list)
activeColor: Colors.black, Row(
groupValue: provider.radioValue, children: [
onChanged: (String? value) { Radio(
setState(() { value: value.name,
// print(value); activeColor: Colors.black,
provider.radioValue = value!; groupValue: provider.radioValue,
int index = onChanged: (String? value) {
list.indexWhere((element) => element.name == value); setState(() {
sectionItem.selectedValue!.add(list[index].id); // print(value);
}); provider.radioValue = value!;
}, int index =
), list.indexWhere((element) => element.name == value);
Text(value.name), sectionItem.selectedValue!.add(list[index].id);
], });
), },
], ),
Text(value.name),
],
),
],
),
), ),
); );
} }
Widget buildCheckbox(SectionList sectionItem, String sectionName, Widget buildCheckbox(SectionList sectionItem, String sectionName,
ViewInteractionProvider provider, bool multiple) { ViewInteractionProvider provider, bool multiple) {
return SizedBox( return Padding(
width: 250, padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Row( child: SizedBox(
children: <Widget>[ // width: 250,
for (var value in provider.checkboxlist) width: MediaQuery.of(context).size.width,
Row(
children: [ child: Row(
Checkbox( children: <Widget>[
value: value.ischecked ?? false, for (var value in provider.checkboxlist)
activeColor: Colors.black, Row(
checkColor: Colors.white, children: [
onChanged: (bool? newvalue) { Checkbox(
value.ischecked = newvalue!; value: value.ischecked ?? false,
provider.setcheckBoxValue( activeColor: Colors.black,
sectionItem, sectionName, newvalue, value.id, multiple); checkColor: Colors.white,
//setState(() {}); onChanged: (bool? newvalue) {
}, value.ischecked = newvalue!;
), provider.setcheckBoxValue(sectionItem, sectionName,
Text(value.name), newvalue, value.id, multiple);
], //setState(() {});
), },
], ),
Text(value.name),
],
),
],
),
), ),
); );
} }
@ -616,79 +657,84 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
sectionItem.selectedObject = list[0]; sectionItem.selectedObject = list[0];
} }
// InputClass selectedObj = list[0]; // InputClass selectedObj = list[0];
return SizedBox( return Padding(
width: isTablet ? 200 : MediaQuery.of(context).size.width, padding: const EdgeInsets.only(left: 8.0, right: 8.0),
height: isTablet ? 60 : 40, child: SizedBox(
child: DropdownButtonFormField2<InputClass>( // width: isTablet ? 200 : MediaQuery.of(context).size.width,
isExpanded: true, // height: isTablet ? 60 : 40,
decoration: InputDecoration( width: MediaQuery.of(context).size.width,
// Add Horizontal padding using menuItemStyleData.padding so it matches
// the menu padding when button's width is not specified. child: DropdownButtonFormField2<InputClass>(
contentPadding: const EdgeInsets.symmetric(vertical: 5), isExpanded: true,
border: OutlineInputBorder( decoration: InputDecoration(
borderRadius: BorderRadius.circular(15), // Add Horizontal padding using menuItemStyleData.padding so it matches
// the menu padding when button's width is not specified.
contentPadding: const EdgeInsets.symmetric(vertical: 5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
// Add more decoration..
), ),
// Add more decoration.. hint: Text(
), 'Select ${sectionItem.name}',
hint: Text( style: const TextStyle(fontSize: 14),
'Select ${sectionItem.name}', ),
style: const TextStyle(fontSize: 14), items: list
), .map((item) => DropdownMenuItem<InputClass>(
items: list value: item,
.map((item) => DropdownMenuItem<InputClass>( child: Text(
value: item, item.name,
child: Text( style: const TextStyle(
item.name, fontSize: 14,
style: const TextStyle( ),
fontSize: 14,
), ),
), ))
)) .toList(),
.toList(), value: sectionItem.selectedValue!.isNotEmpty
value: sectionItem.selectedValue!.isNotEmpty ? list[list.indexWhere(
? list[list.indexWhere( (element) => element.id == sectionItem.selectedValue!.last,
(element) => element.id == sectionItem.selectedValue!.last, )]
)] : list[0],
: list[0], // // provider.getDropDownValue(sectionItem.value!, sectionItem, list)
// // provider.getDropDownValue(sectionItem.value!, sectionItem, list) // sectionItem.value ?? list[0].name,
// sectionItem.value ?? list[0].name, validator: (value) {
validator: (value) { if (value == null) {
if (value == null) { return 'Please select ${sectionItem.name}';
return 'Please select ${sectionItem.name}'; }
} return null;
return null; },
}, onChanged: (value) {
onChanged: (value) { //Do something when selected item is changed.
//Do something when selected item is changed. sectionItem.selectedObject = value!;
sectionItem.selectedObject = value!; sectionItem.value = value.id;
sectionItem.value = value.id; provider.setDropDownValue(value.id, sectionItem, multiple, value);
provider.setDropDownValue(value.id, sectionItem, multiple, value); print("selected ${sectionItem.value}");
print("selected ${sectionItem.value}"); // setState(() {});
// setState(() {}); },
}, onSaved: (value) {
onSaved: (value) { sectionItem.selectedObject = value!;
sectionItem.selectedObject = value!; sectionItem.value = value.id;
sectionItem.value = value.id; provider.setDropDownValue(value.id, sectionItem, multiple, value);
provider.setDropDownValue(value.id, sectionItem, multiple, value); // setState(() {});
// setState(() {}); },
}, buttonStyleData: const ButtonStyleData(
buttonStyleData: const ButtonStyleData( padding: EdgeInsets.only(right: 8),
padding: EdgeInsets.only(right: 8),
),
iconStyleData: const IconStyleData(
icon: Icon(
Icons.arrow_drop_down,
color: Colors.black45,
), ),
iconSize: 24, iconStyleData: const IconStyleData(
), icon: Icon(
dropdownStyleData: DropdownStyleData( Icons.arrow_drop_down,
decoration: BoxDecoration( color: Colors.black45,
borderRadius: BorderRadius.circular(15), ),
iconSize: 24,
),
dropdownStyleData: DropdownStyleData(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(horizontal: 16),
), ),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(horizontal: 16),
), ),
), ),
); );
@ -701,104 +747,109 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
list = sectionItem.inputList!; list = sectionItem.inputList!;
} }
//InputClass selectedObj = list[0]; //InputClass selectedObj = list[0];
return SizedBox( return Padding(
width: isTablet ? 200 : MediaQuery.of(context).size.width, padding: const EdgeInsets.only(left: 8.0, right: 8.0),
height: isTablet ? 60 : 40, child: SizedBox(
child: DropdownButtonHideUnderline( // width: isTablet ? 200 : MediaQuery.of(context).size.width,
child: DropdownButtonFormField2<InputClass>( // height: isTablet ? 60 : 40,
isExpanded: true, width: MediaQuery.of(context).size.width,
decoration: InputDecoration(
// Add Horizontal padding using menuItemStyleData.padding so it matches
// the menu padding when button's width is not specified.
contentPadding: const EdgeInsets.symmetric(vertical: 5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
// Add more decoration..
),
hint: Text(
'Select Item',
style: TextStyle(
fontSize: 14,
color: Theme.of(context).hintColor,
),
),
items: list
.map((item) => DropdownMenuItem(
value: item,
child: Text(
item.name,
style: const TextStyle(
fontSize: 14,
),
),
))
.toList(),
value: sectionItem.selectedObject,
onSaved: (value) {
sectionItem.selectedObject = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
},
onChanged: (value) {
// setState(() {
sectionItem.selectedObject = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
// setState(() {});
//});
},
buttonStyleData: const ButtonStyleData( child: DropdownButtonHideUnderline(
padding: EdgeInsets.symmetric(horizontal: 16), child: DropdownButtonFormField2<InputClass>(
height: 40, isExpanded: true,
width: 200, decoration: InputDecoration(
), // Add Horizontal padding using menuItemStyleData.padding so it matches
dropdownStyleData: const DropdownStyleData( // the menu padding when button's width is not specified.
maxHeight: 200, contentPadding: const EdgeInsets.symmetric(vertical: 5),
), border: OutlineInputBorder(
menuItemStyleData: const MenuItemStyleData( borderRadius: BorderRadius.circular(15),
height: 40,
),
dropdownSearchData: DropdownSearchData(
searchController: textEditingController,
searchInnerWidgetHeight: 50,
searchInnerWidget: Container(
height: 50,
padding: const EdgeInsets.only(
top: 8,
bottom: 4,
right: 8,
left: 8,
), ),
child: TextFormField( // Add more decoration..
expands: true, ),
maxLines: null, hint: Text(
controller: textEditingController, 'Select Item',
decoration: InputDecoration( style: TextStyle(
isDense: true, fontSize: 14,
contentPadding: const EdgeInsets.symmetric( color: Theme.of(context).hintColor,
horizontal: 10, ),
vertical: 8, ),
), items: list
hintText: 'Search for an item...', .map((item) => DropdownMenuItem(
hintStyle: const TextStyle(fontSize: 12), value: item,
border: OutlineInputBorder( child: Text(
borderRadius: BorderRadius.circular(8), item.name,
style: const TextStyle(
fontSize: 14,
),
),
))
.toList(),
value: sectionItem.selectedObject,
onSaved: (value) {
sectionItem.selectedObject = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
},
onChanged: (value) {
// setState(() {
sectionItem.selectedObject = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
// setState(() {});
//});
},
buttonStyleData: const ButtonStyleData(
padding: EdgeInsets.symmetric(horizontal: 16),
height: 40,
width: 200,
),
dropdownStyleData: const DropdownStyleData(
maxHeight: 200,
),
menuItemStyleData: const MenuItemStyleData(
height: 40,
),
dropdownSearchData: DropdownSearchData(
searchController: textEditingController,
searchInnerWidgetHeight: 50,
searchInnerWidget: Container(
height: 50,
padding: const EdgeInsets.only(
top: 8,
bottom: 4,
right: 8,
left: 8,
),
child: TextFormField(
expands: true,
maxLines: null,
controller: textEditingController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search for an item...',
hintStyle: const TextStyle(fontSize: 12),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
), ),
), ),
), ),
searchMatchFn: (item, searchValue) {
return item.value!.name.toString().contains(searchValue);
},
), ),
searchMatchFn: (item, searchValue) { //This to clear the search value when you close the menu
return item.value!.name.toString().contains(searchValue); onMenuStateChange: (isOpen) {
if (!isOpen) {
textEditingController.clear();
}
}, },
), ),
//This to clear the search value when you close the menu
onMenuStateChange: (isOpen) {
if (!isOpen) {
textEditingController.clear();
}
},
), ),
), ),
); );
@ -811,112 +862,117 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
} }
InputClass selectedObj = list[0]; InputClass selectedObj = list[0];
return SizedBox( return Padding(
width: isTablet ? 200 : MediaQuery.of(context).size.width, padding: const EdgeInsets.only(left: 8.0, right: 8.0),
height: isTablet ? 60 : 40, child: SizedBox(
child: DropdownButtonHideUnderline( // width: isTablet ? 200 : MediaQuery.of(context).size.width,
child: DropdownButtonFormField2<InputClass>( // height: isTablet ? 60 : 40,
isExpanded: true, width: MediaQuery.of(context).size.width,
decoration: InputDecoration(
// Add Horizontal padding using menuItemStyleData.padding so it matches child: DropdownButtonHideUnderline(
// the menu padding when button's width is not specified. child: DropdownButtonFormField2<InputClass>(
contentPadding: const EdgeInsets.symmetric(vertical: 5), isExpanded: true,
border: OutlineInputBorder( decoration: InputDecoration(
borderRadius: BorderRadius.circular(15), // Add Horizontal padding using menuItemStyleData.padding so it matches
// the menu padding when button's width is not specified.
contentPadding: const EdgeInsets.symmetric(vertical: 5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
),
// Add more decoration..
), ),
// Add more decoration.. hint: Text(
), 'Select Items',
hint: Text( style: TextStyle(
'Select Items', fontSize: 14,
style: TextStyle( color: Theme.of(context).hintColor,
fontSize: 14, ),
color: Theme.of(context).hintColor,
), ),
), items: list.map((item) {
items: list.map((item) { return DropdownMenuItem(
return DropdownMenuItem( value: item,
value: item, //disable default onTap to avoid closing menu when selecting an item
//disable default onTap to avoid closing menu when selecting an item enabled: false,
enabled: false, child: StatefulBuilder(
child: StatefulBuilder( builder: (context, menuSetState) {
builder: (context, menuSetState) { final isSelected =
final isSelected = sectionItem.selectedValue!.contains(item.name);
sectionItem.selectedValue!.contains(item.name); return InkWell(
return InkWell( onTap: () {
onTap: () { isSelected
isSelected ? sectionItem.selectedValue!.remove(item.name)
? sectionItem.selectedValue!.remove(item.name) : sectionItem.selectedValue!.add(item.name);
: sectionItem.selectedValue!.add(item.name); //This rebuilds the StatefulWidget to update the button's text
//This rebuilds the StatefulWidget to update the button's text setState(() {});
setState(() {}); //This rebuilds the dropdownMenu Widget to update the check mark
//This rebuilds the dropdownMenu Widget to update the check mark menuSetState(() {});
menuSetState(() {}); },
}, child: Container(
child: Container( height: double.infinity,
height: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 16.0),
padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Row(
child: Row( children: [
children: [ if (isSelected)
if (isSelected) const Icon(Icons.check_box_outlined)
const Icon(Icons.check_box_outlined) else
else const Icon(Icons.check_box_outline_blank),
const Icon(Icons.check_box_outline_blank), const SizedBox(width: 16),
const SizedBox(width: 16), Expanded(
Expanded( child: Text(
child: Text( item.name,
item.name, style: const TextStyle(
style: const TextStyle( fontSize: 14,
fontSize: 14, ),
), ),
), ),
), ],
], ),
), ),
);
},
),
);
}).toList(),
//Use last selected item as the current value so if we've limited menu height, it scroll to last item.
value: selectedObj,
// ? null
// : provider.selectedItems.last,
onChanged: (value) {
selectedObj = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
},
onSaved: (value) {
selectedObj = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
},
selectedItemBuilder: (context) {
return list.map(
(item) {
return Container(
alignment: AlignmentDirectional.center,
child: Text(
sectionItem.selectedValue!.join(', '),
style: const TextStyle(
fontSize: 14,
overflow: TextOverflow.ellipsis,
),
maxLines: 1,
), ),
); );
}, },
), ).toList();
); },
}).toList(), buttonStyleData: const ButtonStyleData(
//Use last selected item as the current value so if we've limited menu height, it scroll to last item. padding: EdgeInsets.only(left: 16, right: 8),
value: selectedObj, height: 40,
// ? null width: 140,
// : provider.selectedItems.last, ),
onChanged: (value) { menuItemStyleData: const MenuItemStyleData(
selectedObj = value!; height: 40,
provider.setAutoCompleteValue(value.id, sectionItem, multiple); padding: EdgeInsets.zero,
sectionItem.value = value.name; ),
},
onSaved: (value) {
selectedObj = value!;
provider.setAutoCompleteValue(value.id, sectionItem, multiple);
sectionItem.value = value.name;
},
selectedItemBuilder: (context) {
return list.map(
(item) {
return Container(
alignment: AlignmentDirectional.center,
child: Text(
sectionItem.selectedValue!.join(', '),
style: const TextStyle(
fontSize: 14,
overflow: TextOverflow.ellipsis,
),
maxLines: 1,
),
);
},
).toList();
},
buttonStyleData: const ButtonStyleData(
padding: EdgeInsets.only(left: 16, right: 8),
height: 40,
width: 140,
),
menuItemStyleData: const MenuItemStyleData(
height: 40,
padding: EdgeInsets.zero,
), ),
), ),
), ),

View File

@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:discover_module/constants.dart';
import 'package:discover_module/ui_screen/add_event/add_hcp.dart'; import 'package:discover_module/ui_screen/add_event/add_hcp.dart';
import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
@ -79,7 +80,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
color: Colors.white), color: Colors.white),
), ),
), ),
backgroundColor: const Color(0xFF2b9af3), // backgroundColor: const Color(0xFF2b9af3),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
actions: [saveActions(provider)], actions: [saveActions(provider)],
leading: InkWell( leading: InkWell(
@ -115,8 +116,9 @@ class _InteractionScreenState extends State<InteractionScreen> {
// height: double.infinity, // height: double.infinity,
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF2b9af3), // color: Color(0xFF2b9af3),
color: Constants.k2color,
), ),
child: Text( child: Text(
item.sectionName, item.sectionName,
@ -578,43 +580,55 @@ class _InteractionScreenState extends State<InteractionScreen> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
CustomButton( Padding(
backgroundColor: Colors.red.shade800, padding: const EdgeInsets.all(4.0),
onPressed: () { child: CustomButton(
//showDeleteProfileAlertDialog(context); backgroundColor: Colors.red.shade800,
for (var textcontrollers in provider.textEditingControllerList) { onPressed: () {
textcontrollers.text = ''; //showDeleteProfileAlertDialog(context);
} for (var textcontrollers
in provider.textEditingControllerList) {
textcontrollers.text = '';
}
// setState(() { // setState(() {
// provider.resetAllWidgetsData(); // provider.resetAllWidgetsData();
// }); // });
}, },
textColor: Colors.white, textColor: Colors.white,
title: "Reset", title: "Reset",
height: 40, // height: 40,
width: isTablet ? 100 : 80, // width: isTablet ? 100 : 80,
fontsize: isTablet ? 15 : 10.2, height: MediaQuery.of(context).size.height * 0.2,
fontsize: isTablet ? 15 : 10.2,
),
), ),
SizedBox( SizedBox(
width: isTablet ? 20 : 4, width: isTablet ? 20 : 4,
), ),
CustomButton( Padding(
backgroundColor: Colors.green.shade900, padding: const EdgeInsets.all(4.0),
onPressed: () async { child: CustomButton(
if (textFieldsValidation(provider).isEmpty) { backgroundColor: Colors.green.shade500,
String record = onPressed: () async {
await provider.saveJsonObject(context, widget.form); if (textFieldsValidation(provider).isEmpty) {
showAlertDialog(context, record); String record =
} else { await provider.saveJsonObject(context, widget.form);
_displaySnackBar(textFieldsValidation(provider)); showAlertDialog(context, record);
} } else {
}, _displaySnackBar(textFieldsValidation(provider));
textColor: Colors.white, }
title: "Save", },
height: 40, textColor: Colors.white,
width: isTablet ? 100 : 80, title: "Save",
fontsize: isTablet ? 16 : 12, // height: 40,
// width: isTablet ? 100 : 80,
height: MediaQuery.of(context).size.height * 0.2,
// width: MediaQuery.of(context).size.width * 0.1,
fontsize: isTablet ? 16 : 12,
),
), ),
SizedBox( SizedBox(
width: isTablet ? 20 : 2, width: isTablet ? 20 : 2,
@ -1162,8 +1176,14 @@ class _InteractionScreenState extends State<InteractionScreen> {
setState(() {}); setState(() {});
}, },
width: 80, // width: 80,
height: 30, // height: 30,
height: 40,
// height:
// MediaQuery.of(context).size.height *
// 0.2,
fontsize: 12, fontsize: 12,
textColor: Colors.white, textColor: Colors.white,
title: "Delete"), title: "Delete"),

View File

@ -54,7 +54,16 @@ class _InteractionListScreenState extends State<InteractionListScreen> {
//style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white), //style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
), ),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
backgroundColor: const Color(0xFF2b9af3), // backgroundColor: const Color(0xFF2b9af3),
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
), ),
body: Container( body: Container(
child: Center( child: Center(

View File

@ -46,7 +46,7 @@ class _SavedFormListScreenState extends State<SavedFormListScreen> {
style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white), style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
), ),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
backgroundColor: const Color(0xFF2b9af3), // backgroundColor: const Color(0xFF2b9af3),
leading: InkWell( leading: InkWell(
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);

View File

@ -1,3 +1,4 @@
import 'package:discover_module/constants.dart';
import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart'; import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
@ -58,7 +59,7 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
style: TextStyle( style: TextStyle(
fontSize: isTablet ? 22 : 14, color: Colors.white), fontSize: isTablet ? 22 : 14, color: Colors.white),
), ),
backgroundColor: const Color(0xFF2b9af3), // backgroundColor: const Color(0xFF2b9af3),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
leading: InkWell( leading: InkWell(
onTap: () { onTap: () {
@ -89,8 +90,9 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
// height: double.infinity, // height: double.infinity,
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF2b9af3), // color: Color(0xFF2b9af3),
color: Constants.k2color,
), ),
child: Text( child: Text(
item.sectionName, item.sectionName,
@ -118,28 +120,52 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
child: GridView.count( child: GridView.count(
physics: physics:
const NeverScrollableScrollPhysics(), const NeverScrollableScrollPhysics(),
// crossAxisCount: context.responsive<int>(
// 1,
// sm: 1, // small
// md: 1, // medium
// lg: sectionList.length == 1
// ? 1
// : 4, // large
// xl: 3, // extra large screen
// ),
// mainAxisSpacing:
// sectionList.length == 1 || !isTablet
// ? 1
// : 3.5,
// shrinkWrap: true,
// padding: EdgeInsets.zero,
// childAspectRatio:
// sectionList.length == 1 || !isTablet
// ? orientation ==
// Orientation.landscape
// ? 10
// : 3.8
// : 2.8,
crossAxisCount: context.responsive<int>( crossAxisCount: context.responsive<int>(
1, 1,
sm: 1, // small sm: 1, // small
md: 1, // medium md: 2, // medium
lg: sectionList.length == 1 lg: sectionList.length == 1
? 1 ? 1
: 4, // large : 3, // large
xl: 3, // extra large screen xl: 3, // extra large screen
), ),
mainAxisSpacing: mainAxisSpacing:
sectionList.length == 1 || !isTablet sectionList.length == 1 || !isTablet
? 1 ? 1
: 3.5, : 3.5,
shrinkWrap: true,
padding: EdgeInsets.zero,
childAspectRatio: childAspectRatio:
sectionList.length == 1 || !isTablet sectionList.length == 1
? orientation == ? orientation ==
Orientation.landscape Orientation.landscape
? 10 ? 10
: 3.8 : 4.8
: 2.8, : isTablet
? 2.8
: 3.0,
shrinkWrap: true,
padding: EdgeInsets.zero,
children: List.generate( children: List.generate(
sectionList.length, sectionList.length,
(i) { (i) {

View File

@ -26,10 +26,18 @@ class CustomButton extends StatelessWidget {
width: width, width: width,
child: ElevatedButton( child: ElevatedButton(
onPressed: onPressed, onPressed: onPressed,
style: ButtonStyle( // style: ButtonStyle(
// backgroundColor:
// MaterialStateColor.resolveWith((states) => backgroundColor),
// ),
style: ElevatedButton.styleFrom(
backgroundColor: backgroundColor:
MaterialStateColor.resolveWith((states) => backgroundColor), MaterialStateColor.resolveWith((states) => backgroundColor),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), // <-- Radius
),
), ),
child: Text( child: Text(
title, title,
style: TextStyle(color: textColor, fontSize: fontsize ?? 24.0), style: TextStyle(color: textColor, fontSize: fontsize ?? 24.0),

View File

@ -57,53 +57,77 @@ class _RankingState extends State<Ranking> {
rowsPerPage: 5, rowsPerPage: 5,
columns: const [ columns: const [
DataColumn( DataColumn(
label: Text('Name', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Name',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Tier', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Tier',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Rank', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Rank',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Score', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Score',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Event', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Event',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Affliations', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Affliations',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Publications', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Publications',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn( DataColumn(
label: Text('Trails', label: FittedBox(
style: TextStyle( fit: BoxFit.scaleDown,
fontWeight: FontWeight.bold, child: Text('Trails',
fontSize: 14.0, style: TextStyle(
fontStyle: FontStyle.normal))), fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
], ],
source: _dataSource, source: _dataSource,
), ),
@ -140,7 +164,7 @@ class _RankingState extends State<Ranking> {
showDialog( showDialog(
context: context, context: context,
builder: (_) { builder: (_) {
return Alert(); return Alert(data: "User Added Successfully");
}); });
}, },
)), )),
@ -158,27 +182,47 @@ class _RankingState extends State<Ranking> {
// sheet.getRangeByName('A1').setText('pooja'); // sheet.getRangeByName('A1').setText('pooja');
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
sheet.getRangeByName('A1').setText('Name 1122334455'); sheet.getRangeByName('A1').setText('Name');
sheet.getRangeByName('A2').setText('John'); sheet.getRangeByName('A2').setText('Gerosa, Gino');
sheet.getRangeByName('A3').setText('Ashok'); sheet.getRangeByName('A3').setText('Gerosa, Gino');
sheet.getRangeByName('A4').setText('Vicki'); sheet.getRangeByName('A4').setText('Gerosa, Gino');
final Style headingStyle = workbook.styles.add('HeadingStyle'); final Style headingStyle = workbook.styles.add('HeadingStyle');
headingStyle.bold = true; headingStyle.bold = true;
headingStyle.hAlign = HAlignType.center; headingStyle.hAlign = HAlignType.center;
headingStyle.wrapText = true; headingStyle.wrapText = true;
sheet.getRangeByName('B1').setText('Mark1'); sheet.getRangeByName('B1').setText('Tier');
sheet.getRangeByName('B2').setNumber(10); sheet.getRangeByName('B2').setText("Tier1");
sheet.getRangeByName('B3').setNumber(39); sheet.getRangeByName('B3').setText("Tier1");
sheet.getRangeByName('B4').setNumber(25); sheet.getRangeByName('B4').setText("Tier1");
sheet.getRangeByName('C1').setText('Mark2'); sheet.getRangeByName('C1').setText('Rank');
sheet.getRangeByName('C2').setNumber(49); sheet.getRangeByName('C2').setNumber(1);
sheet.getRangeByName('C3').setNumber(23); sheet.getRangeByName('C3').setNumber(1);
sheet.getRangeByName('C4').setNumber(13); sheet.getRangeByName('C4').setNumber(1);
sheet.getRangeByName('D1').setText('Mark3'); sheet.getRangeByName('D1').setText('Score');
sheet.getRangeByName('D2').setNumber(24); sheet.getRangeByName('D2').setNumber(0);
sheet.getRangeByName('D3').setNumber(30); sheet.getRangeByName('D3').setNumber(0);
sheet.getRangeByName('D4').setNumber(10); sheet.getRangeByName('D4').setNumber(0);
sheet.getRangeByName('E1').setText('Event');
sheet.getRangeByName('E2').setNumber(0);
sheet.getRangeByName('E3').setNumber(0);
sheet.getRangeByName('E4').setNumber(0);
sheet.getRangeByName('F1').setText('Affiliations');
sheet.getRangeByName('F2').setNumber(0);
sheet.getRangeByName('F3').setNumber(0);
sheet.getRangeByName('F4').setNumber(0);
sheet.getRangeByName('G1').setText('Publications');
sheet.getRangeByName('G2').setNumber(0);
sheet.getRangeByName('G3').setNumber(0);
sheet.getRangeByName('G4').setNumber(0);
sheet.getRangeByName('H1').setText('Trails');
sheet.getRangeByName('H2').setNumber(0);
sheet.getRangeByName('H3').setNumber(0);
sheet.getRangeByName('H4').setNumber(0);
//Defining a global style with properties. //Defining a global style with properties.
final Style globalStyle = workbook.styles.add('globalStyle'); final Style globalStyle = workbook.styles.add('globalStyle');
@ -207,10 +251,10 @@ class _RankingState extends State<Ranking> {
globalStyle1.numberFormat = '0.00'; globalStyle1.numberFormat = '0.00';
//Apply GlobalStyle //Apply GlobalStyle
sheet.getRangeByName('A1:D1').cellStyle = globalStyle; // sheet.getRangeByName('A1:D1').cellStyle = globalStyle;
//Apply GlobalStyle1 // //Apply GlobalStyle1
sheet.getRangeByName('B2:D4').cellStyle = globalStyle1; // sheet.getRangeByName('B2:D4').cellStyle = globalStyle1;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
final List<int> bytes = workbook.saveSync(); final List<int> bytes = workbook.saveSync();

View File

@ -125,7 +125,9 @@ class RisingStarState extends State<RisingStar> {
showDialog( showDialog(
context: context, context: context,
builder: (_) { builder: (_) {
return Alert(); return Alert(
data: "User Added Successfully",
);
}); });
}, },
)), )),

View File

@ -100,7 +100,7 @@ class _TrendsState extends State<Trends> {
showDialog( showDialog(
context: context, context: context,
builder: (_) { builder: (_) {
return Alert(); return Alert(data: "User Added Successfully");
}); });
}, },
)), )),