Merge pull request #308 from ente-io/render-overflow-on-loading-photos-screen
This commit is contained in:
commit
13f64ab2c7
3 changed files with 182 additions and 179 deletions
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
|
@ -4,7 +4,6 @@
|
|||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Android Prod",
|
||||
"request": "launch",
|
||||
|
|
|
@ -12,120 +12,123 @@ class GrantPermissionsWidget extends StatelessWidget {
|
|||
MediaQuery.of(context).platformBrightness == Brightness.light;
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 100, 0, 50),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
isLightMode
|
||||
? Image.asset(
|
||||
'assets/loading_photos_light.png',
|
||||
color: Colors.white.withOpacity(0.4),
|
||||
colorBlendMode: BlendMode.modulate,
|
||||
)
|
||||
: Image.asset('assets/loading_photos_dark.png'),
|
||||
Center(
|
||||
child: Image.asset(
|
||||
"assets/gallery.png",
|
||||
height: 160,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 100, 0, 50),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
isLightMode
|
||||
? Image.asset(
|
||||
'assets/loading_photos_light.png',
|
||||
color: Colors.white.withOpacity(0.4),
|
||||
colorBlendMode: BlendMode.modulate,
|
||||
)
|
||||
: Image.asset('assets/loading_photos_dark.png'),
|
||||
Center(
|
||||
child: Image.asset(
|
||||
"assets/gallery.png",
|
||||
height: 160,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headline5
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
children: [
|
||||
TextSpan(text: 'ente '),
|
||||
TextSpan(
|
||||
text: "needs permission to ",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headline5
|
||||
.copyWith(fontWeight: FontWeight.w400),
|
||||
),
|
||||
TextSpan(text: 'preserve your photos')
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: Platform.isIOS ? 84 : 60,
|
||||
),
|
||||
child: OutlinedButton(
|
||||
child: Text("Grant permission"),
|
||||
onPressed: () async {
|
||||
final state = await PhotoManager.requestPermissionExtend();
|
||||
if (state == PermissionState.authorized ||
|
||||
state == PermissionState.limited) {
|
||||
await SyncService.instance.onPermissionGranted(state);
|
||||
} else if (state == PermissionState.denied) {
|
||||
AlertDialog alert = AlertDialog(
|
||||
title: Text("Please grant permissions"),
|
||||
content: Text(
|
||||
"ente can encrypt and preserve files only if you grant access to them",
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
"OK",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.subtitle1
|
||||
.copyWith(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context, rootNavigator: true)
|
||||
.pop('dialog');
|
||||
if (Platform.isIOS) {
|
||||
PhotoManager.openSetting();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
barrierColor: Colors.black12,
|
||||
);
|
||||
}
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headline5
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
children: [
|
||||
TextSpan(text: 'ente '),
|
||||
TextSpan(
|
||||
text: "needs permission to ",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headline5
|
||||
.copyWith(fontWeight: FontWeight.w400),
|
||||
),
|
||||
TextSpan(text: 'preserve your photos'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: Container(
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
spreadRadius: 200,
|
||||
blurRadius: 100,
|
||||
offset: Offset(0, 160),
|
||||
)
|
||||
],
|
||||
),
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: Platform.isIOS ? 40 : 16,
|
||||
),
|
||||
child: OutlinedButton(
|
||||
child: Text("Grant permission"),
|
||||
onPressed: () async {
|
||||
final state = await PhotoManager.requestPermissionExtend();
|
||||
if (state == PermissionState.authorized ||
|
||||
state == PermissionState.limited) {
|
||||
await SyncService.instance.onPermissionGranted(state);
|
||||
} else if (state == PermissionState.denied) {
|
||||
AlertDialog alert = AlertDialog(
|
||||
title: Text("Please grant permissions"),
|
||||
content: Text(
|
||||
"ente can encrypt and preserve files only if you grant access to them",
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
"OK",
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context, rootNavigator: true).pop('dialog');
|
||||
if (Platform.isIOS) {
|
||||
PhotoManager.openSetting();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
barrierColor: Colors.black12,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,81 +83,82 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
|
|||
final isLightMode =
|
||||
MediaQuery.of(context).platformBrightness == Brightness.light;
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
isLightMode
|
||||
? Image.asset(
|
||||
'assets/loading_photos_light.png',
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
colorBlendMode: BlendMode.modulate,
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/loading_photos_light.png',
|
||||
color: Colors.white.withOpacity(0.25),
|
||||
colorBlendMode: BlendMode.modulate,
|
||||
),
|
||||
Lottie.asset(
|
||||
'assets/loadingGalleryLottie.json',
|
||||
height: 400,
|
||||
)
|
||||
],
|
||||
),
|
||||
Text(
|
||||
"Loading your photos...",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.subTextColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
isLightMode
|
||||
? Image.asset(
|
||||
'assets/loading_photos_light.png',
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
colorBlendMode: BlendMode.modulate,
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/loading_photos_light.png',
|
||||
color: Colors.white.withOpacity(0.25),
|
||||
colorBlendMode: BlendMode.modulate,
|
||||
),
|
||||
Lottie.asset(
|
||||
'assets/loadingGalleryLottie.json',
|
||||
height: 400,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(36)),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Did you know?",
|
||||
style: Theme.of(context).textTheme.headline6.copyWith(
|
||||
color: Theme.of(context).colorScheme.greenText,
|
||||
),
|
||||
),
|
||||
],
|
||||
Text(
|
||||
"Loading your photos...",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.subTextColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
SizedBox(
|
||||
height: 175,
|
||||
child: Stack(
|
||||
),
|
||||
const SizedBox(height: 54),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
PageView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
controller: _pageController,
|
||||
itemBuilder: (context, index) {
|
||||
return _getMessage(_messages[index]);
|
||||
},
|
||||
itemCount: _messages.length,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
Text(
|
||||
"Did you know?",
|
||||
style: Theme.of(context).textTheme.headline6.copyWith(
|
||||
color: Theme.of(context).colorScheme.greenText,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: BottomShadowWidget(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
SizedBox(
|
||||
height: 175,
|
||||
child: Stack(
|
||||
children: [
|
||||
PageView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
controller: _pageController,
|
||||
itemBuilder: (context, index) {
|
||||
return _getMessage(_messages[index]);
|
||||
},
|
||||
itemCount: _messages.length,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: BottomShadowWidget(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue