Hello and thank you for your library.
Im using your library for placing a background color to my image. Using the lastest versions of flutter and your library, this is the error i'm receiving:
════════ Exception caught by scheduler library ═════════════════════════════════
'package:image_pixels/src/image_pixels.dart': Failed assertion: line 252 pos 16: 'buildContext != null': is not true.
════════════════════════════════════════════════════════════════════════════════
import 'package:flutter/material.dart';
import 'package:image_pixels/image_pixels.dart';
class SwipeCard extends StatelessWidget {
const SwipeCard({
Key key,
this.cardWidth,
this.cardHeight,
this.fooName,
this.foo2Name,
this.imageUrl,
}) : super(key: key);
final double cardHeight;
final double cardWidth;
final String fooName;
final String foo2Name;
final String imageUrl;
@override
Widget build(BuildContext context) {
return ImagePixels.container(
defaultColor: Color.fromRGBO(20, 20, 22, 1),
imageProvider: NetworkImage(imageUrl != null ? imageUrl : ''),
colorAlignment: Alignment.topLeft,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color.fromRGBO(21, 21, 22, 0.5),
const Color.fromRGBO(20, 20, 22, 1),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [0.0, 1]),
),
width: cardWidth,
height: cardHeight,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
Container(
...
return Stack(
children: [
Consumer<FooNotifier>(builder: (__, consumerValues, _) {
return FutureBuilder(
future: fooFuture,
// ignore: missing_return
builder: (context, snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.none:
break;
case ConnectionState.waiting:
return Center(child: CircularProgressIndicator());
break;
case ConnectionState.done:
return consumerValues.swiperList.length != 0
? ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemCount: consumerValues.swiperList.length ?? 0,
itemBuilder: (BuildContext context, int index) {
return Dismissible(
resizeDuration: Duration(milliseconds: 1500),
onDismissed: (DismissDirection direction) {
setState(() {
consumerValues.swiperList.removeAt(index);
print(consumerValues.swiperList);
});
},
secondaryBackground: Container(
child: Center(
child: Text(
'Foo geliked',
style: TextStyle(color: Colors.black),
),
),
color: Colors.lightGreenAccent,
),
background: Container(
child: Center(
child: Text(
'Nicht interessant',
style: TextStyle(color: Colors.black),
),
),
color: Colors.redAccent),
child: SwipeCard(
cardWidth: MediaQuery.of(context).size.width * 1,
cardHeight:
MediaQuery.of(context).size.height * 1,
fooName:
consumerValues.swiperList[index].fooName,
foo2Name:
consumerValues.swiperList[index].foo2Name,
imageUrl:
consumerValues.swiperList[index].imageUrl,
),
key: UniqueKey(),
direction: DismissDirection.horizontal,
);
},
)
: SwipeNoItems();
break;
default:
}
},
);
}),
SafeArea(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
icon: SvgPicture.asset(
'assets/icon-close-boxed.svg',
fit: BoxFit.contain,
width: 35,
height: 35,
//color: Colors.white,
),
onPressed: () async {
await Provider.of<FooControls>(context,
listen: false)
.stop();
widget.func(0);
},
tooltip: 'Close',
),
],
),
),
),
],
);