I am new to flutter can u help me to get out from this....!
"Another exception was thrown: SliverGeometry is not valid: The "scrollExtent" is negative."
I have seen many tutorials on youtube google but i cant find solution on this i dnt knw how to get solution from in this.. plz help meeee! thank you for your time!
import 'package:flutter/material.dart';
import 'dart:ui';
import 'dart:convert';
import 'data/newshelfdata.dart';
import 'data/shelfscreendata.dart';
import 'package:google_fonts/google_fonts.dart';
import 'constant/constant.dart' as Constants;
import 'PhotographerWelcomeNote.dart';
import 'package:http/http.dart' as http;
import 'Utility/global.dart' as Globals;
import 'data/errordata.dart';
import 'data/shelfscreendata.dart';
import 'data/shelfscreendata.dart';
class ShelfScreen extends StatefulWidget {
@override
_ShelfScreenState createState() => _ShelfScreenState();
}
class _ShelfScreenState extends State<ShelfScreen> {
bool _isLoading = false;
List<CompaignShelfList> _camp = List<CompaignShelfList>();
Future<List<CompaignShelfList>> Shelf() async {
Map data = {
"AccessToken": "MjUyLTg1REEyUzMtQURTUzVELUVJNUI0QTIyMTE=",
"CustomerId": 1
};
final http.Response response = await http.post(
"http://api.pgapp.in/v1/shelflist",
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(data),
);
var jsonResponse = null;
// debugPrint(CompaignShelfList.toString());
var camp = List<CompaignShelfList>();
if (response.statusCode == 200)
{
jsonResponse = json.decode(response.body);
for (var jsonResponse in jsonResponse)
{
camp.add(CompaignShelfList.fromJson(jsonResponse));
}
}
return camp;
}
@override
void initState() {
super.initState();
Shelf();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xfff8f8f8),
leading: Padding(
padding: EdgeInsets.only(left: 20),
child: Image.asset("assets/logo.png",width: 45,height: 45,),
),
title: Center(
child: Image.asset("assets/Textimage.png",width: 170,height: 45),
),
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 20,top: 10,bottom: 10),
child: Container(
height: 8,
width: 35,
child: CircleAvatar(
maxRadius: 20,
backgroundImage: AssetImage("assets/images/prof.jpg"),
),
),
),
],
),
body: GridView.builder(
shrinkWrap: false,
scrollDirection: Axis.vertical,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
childAspectRatio:MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 2),
mainAxisSpacing: 1.0,
crossAxisSpacing: 1.0,
),
itemCount: _camp.length,
itemBuilder: (context, int index){
return
CategoriesTile(
imgUrls: _camp[index].coverImagePath,
catagory:_camp[index].businessName,
date: _camp[index].date,
email: _camp[index].photographerEmail,
stduio:_camp[index].photographerMobileNumber,
);
// Image.asset(Shelflist[index]["text_3"],fit: BoxFit.cover,);
}
)
);
}
}
class CategoriesTile extends StatelessWidget {
final String imgUrls, catagory , date,email,stduio;
CategoriesTile({@required this.imgUrls, @required this.catagory,@required this.date,@required
this.email,@required this.stduio});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotographerWelcomeNote(
Coverpic: imgUrls,
)));
},
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
elevation: 5,
child: Container(
margin: EdgeInsets.all(8),
child:
Stack(
children: <Widget>[
Positioned(
top: 1,
left: 1,
right: 1,
bottom: 50,
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child:Image.asset(
imgUrls,
height: 250,
width: 400,
fit: BoxFit.cover,
)
),
),
Positioned(
bottom: 50,
left: 1,
right: 1,
// width: 400,
height: 60,
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3, sigmaY: 3),
child: Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0),
borderRadius: BorderRadius.circular(8),
),
),
),
),
),
Positioned(
bottom: 80,
left: 20,
child: Container(
height: 50,
width: 400,
alignment: Alignment.bottomLeft,
child: Text(
catagory ?? "Yo Yo",
style: GoogleFonts.nunito(
fontSize: 18,
color: const Color(0xffffffff),
fontWeight: FontWeight.w700,
height: 1.7647058823529411,
),
)),
),
Positioned(
left: 20,
bottom: 60,
child: Container(
height: 30,
width: 150,
alignment: Alignment.bottomLeft,
child: Text(
date,style: GoogleFonts.nunito(
fontSize: 13,
color: const Color(0xffffffff),
fontWeight: FontWeight.w700,
height: 1.7647058823529411,
),
),
),
),
Positioned(
bottom: 20,
left: 90,
child: Container(
height: 23,
alignment: Alignment.center,
child: Text(
stduio,
style: GoogleFonts.nunito(
fontSize: 18,
color: const Color(0xff7f7f7f),
fontWeight: FontWeight.w700,
)
),
),
),
Positioned(
bottom: 1,
left: 90,
child: Container(
height: 20,
alignment: Alignment.center,
child: Text(
email,style: GoogleFonts.nunito(
fontSize: 10,
color: const Color(0xffb4b4b4),
fontWeight: FontWeight.w600,
),
),
),
),
Positioned(
bottom: 2,
left: 10,
child: Container(
width: 66.0,
height: 39.0,
decoration: BoxDecoration(
image: DecorationImage(
image: const AssetImage(
'assets/images/camlogo.jpg'),
fit: BoxFit.cover,
),
border: Border.all(
width: 1.0, color: const Color(0xffb4b4b4)),
),
),
),
],
),
),
),
);
}
}
User contributions licensed under CC BY-SA 3.0