Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallpaper Info Screen #4

Open
nooralibutt opened this issue Jan 16, 2023 · 2 comments
Open

Wallpaper Info Screen #4

nooralibutt opened this issue Jan 16, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@nooralibutt
Copy link
Owner

nooralibutt commented Jan 16, 2023

We will provide wallpaper size, name and its dimentions

@nooralibutt nooralibutt added the enhancement New feature or request label Jan 16, 2023
@alibahadar730
Copy link

alibahadar730 commented Jan 17, 2023

to get the dimentions of a wallpaper use this method

final Image image = const Image(
image: NetworkImage(
'https://i.pinimg.com/564x/54/6c/14/546c14575789924ec3e302296f82d75f.jpg'));
Future<ui.Image> _getImageInfo() {
Completer<ui.Image> completer = Completer<ui.Image>();
image.image.resolve(const ImageConfiguration()).addListener(
ImageStreamListener(
(ImageInfo info, bool _) => completer.complete(info.image)));
return completer.future;
}

@alibahadar730
Copy link

alibahadar730 commented Jan 17, 2023

to get the dimensions of a wallpaper this will be the implementation

FutureBuilder<ui.Image>(
future: _getImageInfo(),
builder: (BuildContext context, AsyncSnapshot<ui.Image> snapshot) {
if (snapshot.hasData) {
ui.Image? image = snapshot.data;
return Text(
'${image?.width}x${image?.height}',
);
} else {
return const Text('Loading...');
}
},
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants