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(
strokeWidth: 3,
);
return const Center(child: CircularProgressIndicator());
},
);
}

View File

@ -19,9 +19,9 @@ class ImageTile extends StatelessWidget {
},
child: Container(
padding: const EdgeInsets.all(3),
child: Container(
decoration: imageUri == null
? BoxDecoration(
child: imageUri == null
? Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(calcTileMaxWidth() / 30)),
@ -30,12 +30,10 @@ class ImageTile extends StatelessWidget {
color: Colors.black12,
spreadRadius: calcTileMaxWidth() / 150,
blurRadius: calcTileMaxWidth() / 60),
])
: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: dtaProvider!.getImageProvider(imageUri!),
),
]),
child: child)
: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(calcTileMaxWidth() / 30)),
boxShadow: [
@ -44,7 +42,23 @@ class ImageTile extends StatelessWidget {
spreadRadius: calcTileMaxWidth() / 150,
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 => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.trackpad
};
}