我正在使用SliverAppBar。
上一页我有2页让我们说(搜索和详细信息),
在详细信息页面中,当我按下按钮返回后,当我向下滚动并使图像不可见时,我的图像丢失了搜索页面。但是,如果我向下滚动,然后小的向上滚动使图像可见,然后按返回按钮,则我的图像不会丢失并且仍然停留在该位置。
您能帮我吗?
谢谢
<script>
document.getElementById("textarea").value = document.getElementById("content").innerHTML;
</script>
<div id="content" contenteditable="true">Text</div>
<form>
<textarea id="textarea" style="display:none"></textarea>
</form>
import 'package:flutter/material.dart';
import 'package:flutter_news/model/Berita_model.dart';
import 'package:flutter_news/widget/Widget_builder.dart';
class WartawanDetail extends StatefulWidget {
final int idWartawan;
final String gambarWartawan;
final String namaWartawan;
WartawanDetail({this.idWartawan, this.gambarWartawan, this.namaWartawan});
@override
_WartawanDetailState createState() => _WartawanDetailState();
}
class _WartawanDetailState extends State<WartawanDetail> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
floating: true,
pinned: false,
leading: IconButton(
icon: Icon(Icons.arrow_left),
onPressed: () => Navigator.pop(context),
),
expandedHeight: 300.0,
centerTitle: true,
flexibleSpace: FlexibleSpaceBar(
background: Hero(
tag: widget.idWartawan,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(widget.gambarWartawan),
fit: BoxFit.cover),
),
child: Stack(
children: <Widget>[
Positioned(
bottom: 10,
left: 10,
child: Material(
color: Colors.transparent,
child: Chip(
backgroundColor: Colors.blue,
labelStyle: TextStyle(color: Colors.white),
label: Text(widget.namaWartawan),
),
),
),
Positioned(
bottom: 10,
right: 10,
child: Material(
color: Colors.transparent,
child: Chip(
backgroundColor: Colors.blue,
labelStyle: TextStyle(color: Colors.white),
label: Text("2 Berita"),
),
),
),
],
),
),
),
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.more_horiz),
onPressed: () => "",
),
],
),
SliverFixedExtentList(
itemExtent: MediaQuery.of(context).size.height,
delegate: SliverChildListDelegate(
[
Container(
padding: EdgeInsets.all(8),
child: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: beritas.length,
itemBuilder: newsBuilderHome),
),
],
),
)
],
),
);
}
}