嗨,我正在尝试使用OfflineBuilder
和LiquidSwipe
但它不起作用,而且我不知道为什么有人可以帮助我?谢谢!
Widget build(BuildContext context) {
final pages = [
//pagina1
Container(
color: connected ? Colors.purple[700] : color: Colors.red,
),
Container(
color: Colors.pink[700]
),
];
return Scaffold(
body: OfflineBuilder(
connectivityBuilder: (
BuildContext context,
ConnectivityResult connectivity,
Widget child,
) {
final bool connected = connectivity != ConnectivityResult.none;
return LiquidSwipe(
pages: pages,
enableLoop: true,
fullTransitionValue: 700,
enableSlideIcon: false,
waveType: WaveType.liquidReveal,
positionSlideIcon: 0.7,
);
}),
);
}
}
您没有使用OfflineBuilder
中的connected
。试试这个
final pages(bool connected) => [
//pagina1
Container(
color: connected ? Colors.purple[700] : color: Colors.red,
),
Container(
color: Colors.pink[700]
),
];
Widget build(BuildContext context) {
return Scaffold(
body: OfflineBuilder(
connectivityBuilder: (
BuildContext context,
ConnectivityResult connectivity,
Widget child,
) {
final bool connected = connectivity != ConnectivityResult.none;
return LiquidSwipe(
pages: pages(connected),
enableLoop: true,
fullTransitionValue: 700,
enableSlideIcon: false,
waveType: WaveType.liquidReveal,
positionSlideIcon: 0.7,
);
},
),
);
}
}