load indicator on image grid

center load indicator on directory load
support for trackpads
This commit is contained in:
lukas-heiligenbrunner 2022-10-07 12:38:53 +02:00
parent cc2f9dbb94
commit 9373df296c
3 changed files with 40 additions and 27 deletions

View File

@ -107,9 +107,7 @@ class _ImageGridState extends State<ImageGrid> {
} }
} }
return const CircularProgressIndicator( return const Center(child: CircularProgressIndicator());
strokeWidth: 3,
);
}, },
); );
} }

View File

@ -19,9 +19,9 @@ class ImageTile extends StatelessWidget {
}, },
child: Container( child: Container(
padding: const EdgeInsets.all(3), padding: const EdgeInsets.all(3),
child: Container( child: imageUri == null
decoration: imageUri == null ? Container(
? BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(calcTileMaxWidth() / 30)), Radius.circular(calcTileMaxWidth() / 30)),
@ -30,12 +30,10 @@ class ImageTile extends StatelessWidget {
color: Colors.black12, color: Colors.black12,
spreadRadius: calcTileMaxWidth() / 150, spreadRadius: calcTileMaxWidth() / 150,
blurRadius: calcTileMaxWidth() / 60), blurRadius: calcTileMaxWidth() / 60),
]) ]),
: BoxDecoration( child: child)
image: DecorationImage( : Container(
fit: BoxFit.cover, decoration: BoxDecoration(
image: dtaProvider!.getImageProvider(imageUri!),
),
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(calcTileMaxWidth() / 30)), Radius.circular(calcTileMaxWidth() / 30)),
boxShadow: [ boxShadow: [
@ -44,7 +42,23 @@ class ImageTile extends StatelessWidget {
spreadRadius: calcTileMaxWidth() / 150, spreadRadius: calcTileMaxWidth() / 150,
blurRadius: calcTileMaxWidth() / 60), blurRadius: calcTileMaxWidth() / 60),
]), ]),
child: child)), child: ClipRRect(
); borderRadius: BorderRadius.all(
Radius.circular(calcTileMaxWidth() / 30),
),
child: Image(
fit: BoxFit.cover,
frameBuilder:
(context, child, frame, wasSynchronouslyLoaded) {
return frame == null
? const Center(
child: CircularProgressIndicator(),
)
: child;
},
image: dtaProvider!.getImageProvider(imageUri!),
)),
),
));
} }
} }

View File

@ -23,6 +23,7 @@ class AppScrollBehavior extends MaterialScrollBehavior {
Set<PointerDeviceKind> get dragDevices => { Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch, PointerDeviceKind.touch,
PointerDeviceKind.mouse, PointerDeviceKind.mouse,
PointerDeviceKind.trackpad
}; };
} }