Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Scrolling Issue in Hyperledger #370

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 102 additions & 99 deletions lib/programs screen/hyperledger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ class _HyperledgerState extends State<Hyperledger> {
late Future<void> getProjectFunction;

Future<void> initializeProjectLists() async {
var response =
await rootBundle.loadString('assets/projects/hyperledger/hyperledger2024.json');
var response = await rootBundle
.loadString('assets/projects/hyperledger/hyperledger2024.json');
var jsonList = await json.decode(response);
for (var data in jsonList) {
hyperledger2024.add(HyperledgerProjectModal.fromJson(data));
}
projectList = hyperledger2024;
print(projectList);
response =
await rootBundle.loadString('assets/projects/hyperledger/hyperledger2023.json');
response = await rootBundle
.loadString('assets/projects/hyperledger/hyperledger2023.json');
jsonList = await json.decode(response);
for (var data in jsonList) {
hyperledger2023.add(HyperledgerProjectModal.fromJson(data));
}
response =
await rootBundle.loadString('assets/projects/hyperledger/hyperledger2022.json');
response = await rootBundle
.loadString('assets/projects/hyperledger/hyperledger2022.json');
jsonList = await json.decode(response);
for (var data in jsonList) {
hyperledger2022.add(HyperledgerProjectModal.fromJson(data));
}
response =
await rootBundle.loadString('assets/projects/hyperledger/hyperledger2021.json');
response = await rootBundle
.loadString('assets/projects/hyperledger/hyperledger2021.json');
jsonList = await json.decode(response);
for (var data in jsonList) {
hyperledger2021.add(HyperledgerProjectModal.fromJson(data));
Expand Down Expand Up @@ -154,7 +154,8 @@ class _HyperledgerState extends State<Hyperledger> {
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const HYPERLEDGERInfo()),
MaterialPageRoute(
builder: (context) => const HYPERLEDGERInfo()),
);
},
),
Expand All @@ -168,12 +169,9 @@ class _HyperledgerState extends State<Hyperledger> {
} else if (snapshot.hasError) {
return Center(child: Text("Error: ${snapshot.error}"));
} else if (snapshot.connectionState == ConnectionState.done) {
return Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(46),
vertical: ScreenUtil().setHeight(16),
),
child: SingleChildScrollView(
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 46, vertical: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expand All @@ -184,19 +182,23 @@ class _HyperledgerState extends State<Hyperledger> {
suffixIcon: const Icon(Icons.search),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFFEEEEEE)),
borderSide:
const BorderSide(color: Color(0xFFEEEEEE)),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFFEEEEEE)),
borderSide:
const BorderSide(color: Color(0xFFEEEEEE)),
),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFFEEEEEE)),
borderSide:
const BorderSide(color: Color(0xFFEEEEEE)),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFFEEEEEE)),
borderSide:
const BorderSide(color: Color(0xFFEEEEEE)),
),
contentPadding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(12),
Expand All @@ -213,89 +215,90 @@ class _HyperledgerState extends State<Hyperledger> {
},
),
SizedBox(height: ScreenUtil().setHeight(20)),
SizedBox(
height: MediaQuery.of(context).size.height * 0.25,
child: GridView(
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: 1.5 / 0.6,
crossAxisCount: 2,
crossAxisSpacing: 15,
mainAxisSpacing: 15,
Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.2,
),
children: [
YearButton(
year: "2024",
isEnabled: selectedYear == 2024,
onTap: () {
setState(() {
projectList = hyperledger2024;
selectedYear = 2024;
});
},
backgroundColor: selectedYear == 2024
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
),
YearButton(
year: "2023",
isEnabled: selectedYear == 2023,
onTap: () {
setState(() {
projectList = hyperledger2023;
selectedYear = 2023;
});
},
backgroundColor: selectedYear == 2023
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
),
YearButton(
year: "2022",
isEnabled: selectedYear == 2022,
onTap: () {
setState(() {
projectList = hyperledger2022;
selectedYear = 2022;
});
},
backgroundColor: selectedYear == 2022
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
width: MediaQuery.sizeOf(context).width,
child: GridView(
physics: const NeverScrollableScrollPhysics(),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 1.5 / 0.6,
crossAxisSpacing: 15,
mainAxisSpacing: 15,
),
YearButton(
year: "2021",
isEnabled: selectedYear == 2021,
onTap: () {
setState(() {
projectList = hyperledger2021;
selectedYear = 2021;
});
},
backgroundColor: selectedYear == 2021
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
),
],
),
),
SizedBox(height: ScreenUtil().setHeight(20)),
SizedBox(
height: MediaQuery.of(context).size.height * 0.6,
child: ListView.builder(
itemCount: projectList.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: HyperledgerProjectWidget(
modal: projectList[index],
height: ScreenUtil().screenHeight * 0.2,
width: ScreenUtil().screenWidth,
index: index+1,
children: [
YearButton(
year: "2024",
isEnabled: selectedYear == 2024,
onTap: () {
setState(() {
projectList = hyperledger2024;
selectedYear = 2024;
});
},
backgroundColor: selectedYear == 2024
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
),
);
},
),
YearButton(
year: "2023",
isEnabled: selectedYear == 2023,
onTap: () {
setState(() {
projectList = hyperledger2023;
selectedYear = 2023;
});
},
backgroundColor: selectedYear == 2023
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
),
YearButton(
year: "2022",
isEnabled: selectedYear == 2022,
onTap: () {
setState(() {
projectList = hyperledger2022;
selectedYear = 2022;
});
},
backgroundColor: selectedYear == 2022
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
),
YearButton(
year: "2021",
isEnabled: selectedYear == 2021,
onTap: () {
setState(() {
projectList = hyperledger2021;
selectedYear = 2021;
});
},
backgroundColor: selectedYear == 2021
? Colors.white
: const Color.fromRGBO(255, 183, 77, 1),
)
],
)),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: projectList.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: HyperledgerProjectWidget(
modal: projectList[index],
height: ScreenUtil().screenHeight * 0.2,
width: ScreenUtil().screenWidth,
index: index + 1,
),
);
},
),
],
),
Expand Down
Loading