|
@@ -1,3 +1,4 @@
|
|
|
|
|
+import 'package:cached_network_image/cached_network_image.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:photo_view/photo_view.dart';
|
|
import 'package:photo_view/photo_view.dart';
|
|
|
import 'package:photo_view/photo_view_gallery.dart';
|
|
import 'package:photo_view/photo_view_gallery.dart';
|
|
@@ -16,12 +17,15 @@ class _PhotoViewState extends State<PhotoView> with WidgetsBindingObserver {
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
return Scaffold(
|
|
return Scaffold(
|
|
|
|
|
+ appBar: AppBar(
|
|
|
|
|
+ title: Text(''),
|
|
|
|
|
+ ),
|
|
|
backgroundColor: Colors.black,
|
|
backgroundColor: Colors.black,
|
|
|
body: PhotoViewGallery.builder(
|
|
body: PhotoViewGallery.builder(
|
|
|
scrollPhysics: const BouncingScrollPhysics(),
|
|
scrollPhysics: const BouncingScrollPhysics(),
|
|
|
builder: (BuildContext context, int index) {
|
|
builder: (BuildContext context, int index) {
|
|
|
return PhotoViewGalleryPageOptions(
|
|
return PhotoViewGalleryPageOptions(
|
|
|
- imageProvider: NetworkImage(widget.imageList[index]),
|
|
|
|
|
|
|
+ imageProvider: CachedNetworkImageProvider(widget.imageList[index]),
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
itemCount: widget.imageList.length,
|
|
itemCount: widget.imageList.length,
|
|
@@ -37,9 +41,27 @@ class _PhotoViewState extends State<PhotoView> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
// )
|
|
// )
|
|
|
),
|
|
),
|
|
|
- floatingActionButton: Container(
|
|
|
|
|
- padding: EdgeInsets.all(30),
|
|
|
|
|
- child: Text('${nowIndex}/${widget.imageList.length}', style: TextStyle(color: Colors.white)),
|
|
|
|
|
|
|
+ floatingActionButton: Column(
|
|
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Text('${nowIndex}/${widget.imageList.length}', style: TextStyle(color: Colors.white)),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ width: 220,
|
|
|
|
|
+ height: 36,
|
|
|
|
|
+ margin: EdgeInsets.only(top: 10, bottom: 20),
|
|
|
|
|
+ child: RaisedButton(
|
|
|
|
|
+ color: Color(0xFFD4504B),
|
|
|
|
|
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ '我已设置完毕',
|
|
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
+ ),
|
|
|
|
|
+ onPressed: () {
|
|
|
|
|
+ Navigator.of(context).pop(true);
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
),
|
|
),
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
);
|
|
);
|