|
@@ -10,7 +10,6 @@ import 'package:photos/services/user_service.dart';
|
|
|
import 'package:photos/ui/loading_widget.dart';
|
|
|
import 'package:photos/ui/payment/subscription.dart';
|
|
|
import 'package:photos/utils/data_util.dart';
|
|
|
-import 'package:photos/utils/toast_util.dart';
|
|
|
|
|
|
class DetailsSectionWidget extends StatefulWidget {
|
|
|
DetailsSectionWidget({Key key}) : super(key: key);
|
|
@@ -71,7 +70,7 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
|
|
|
);
|
|
|
},
|
|
|
child: SizedBox(
|
|
|
- height: 148,
|
|
|
+ height: 172,
|
|
|
child: _userDetails == null ? loadWidget : getContainer(),
|
|
|
),
|
|
|
);
|
|
@@ -79,19 +78,21 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
|
|
|
|
|
|
Container getContainer() {
|
|
|
return Container(
|
|
|
- width: double.infinity,
|
|
|
- height: 148,
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.transparent,
|
|
|
borderRadius: BorderRadius.only(
|
|
|
- topRight: Radius.circular(16), bottomLeft: Radius.circular(16)),
|
|
|
+ topRight: Radius.circular(16),
|
|
|
+ bottomLeft: Radius.circular(16),
|
|
|
+ topLeft: Radius.circular(2),
|
|
|
+ bottomRight: Radius.circular(2),
|
|
|
+ ),
|
|
|
image: DecorationImage(
|
|
|
fit: BoxFit.fill,
|
|
|
image: AssetImage("assets/card_background.png"),
|
|
|
),
|
|
|
),
|
|
|
child: Padding(
|
|
|
- padding: EdgeInsets.only(top: 12, bottom: 12, left: 20, right: 0),
|
|
|
+ padding: EdgeInsets.only(top: 24, bottom: 24, left: 20, right: 0),
|
|
|
child: Column(
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
@@ -103,7 +104,7 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
|
|
|
.subtitle1
|
|
|
.copyWith(color: Colors.white.withOpacity(0.7)),
|
|
|
),
|
|
|
- Padding(padding: EdgeInsets.symmetric(vertical: 2)),
|
|
|
+ Padding(padding: EdgeInsets.symmetric(vertical: 3)),
|
|
|
Text(
|
|
|
"${convertBytesToReadableFormat(_userDetails.getFreeStorage())} of ${convertBytesToReadableFormat(_userDetails.getTotalStorage())} free",
|
|
|
style: Theme.of(context)
|
|
@@ -147,82 +148,64 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
|
|
|
),
|
|
|
),
|
|
|
Padding(padding: EdgeInsets.symmetric(vertical: 6)),
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- int totalStorage = _userDetails.isPartOfFamily()
|
|
|
- ? _userDetails.familyData.storage
|
|
|
- : _userDetails.subscription.storage;
|
|
|
- String usageText = formatBytes(_userDetails.getFreeStorage()) +
|
|
|
- " / " +
|
|
|
- convertBytesToReadableFormat(totalStorage) +
|
|
|
- " free";
|
|
|
- if (_userDetails.isPartOfFamily()) {
|
|
|
- usageText +=
|
|
|
- "\npersonal usage: ${convertBytesToReadableFormat(_userDetails.getPersonalUsage())}\n"
|
|
|
- "family usage: ${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage() - _userDetails.getPersonalUsage())}";
|
|
|
- }
|
|
|
- showToast(usageText);
|
|
|
- },
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- _userDetails.isPartOfFamily()
|
|
|
- ? Row(
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- width: 10,
|
|
|
- height: 10,
|
|
|
- decoration: BoxDecoration(
|
|
|
- shape: BoxShape.circle,
|
|
|
- color: Colors.white,
|
|
|
- ),
|
|
|
- ),
|
|
|
- Padding(padding: EdgeInsets.only(right: 4)),
|
|
|
- Text(
|
|
|
- "You",
|
|
|
- style: Theme.of(context)
|
|
|
- .textTheme
|
|
|
- .bodyText1
|
|
|
- .copyWith(color: Colors.white),
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ _userDetails.isPartOfFamily()
|
|
|
+ ? Row(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ width: 10,
|
|
|
+ height: 10,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ shape: BoxShape.circle,
|
|
|
+ color: Colors.white,
|
|
|
),
|
|
|
- Padding(padding: EdgeInsets.only(right: 12)),
|
|
|
- Container(
|
|
|
- width: 10,
|
|
|
- height: 10,
|
|
|
- decoration: BoxDecoration(
|
|
|
- shape: BoxShape.circle,
|
|
|
- color: Colors.white.withOpacity(0.75),
|
|
|
- ),
|
|
|
+ ),
|
|
|
+ Padding(padding: EdgeInsets.only(right: 4)),
|
|
|
+ Text(
|
|
|
+ "You",
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText1
|
|
|
+ .copyWith(color: Colors.white),
|
|
|
+ ),
|
|
|
+ Padding(padding: EdgeInsets.only(right: 12)),
|
|
|
+ Container(
|
|
|
+ width: 10,
|
|
|
+ height: 10,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ shape: BoxShape.circle,
|
|
|
+ color: Colors.white.withOpacity(0.75),
|
|
|
),
|
|
|
- Padding(padding: EdgeInsets.only(right: 4)),
|
|
|
- Text(
|
|
|
- "Family",
|
|
|
- style: Theme.of(context)
|
|
|
- .textTheme
|
|
|
- .bodyText1
|
|
|
- .copyWith(color: Colors.white),
|
|
|
- ),
|
|
|
- ],
|
|
|
- )
|
|
|
- : Text(
|
|
|
- "${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage())} used",
|
|
|
- style: Theme.of(context).textTheme.headline5.copyWith(
|
|
|
- color: Colors.white.withOpacity(0.7),
|
|
|
- fontSize: 14),
|
|
|
- ),
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.only(right: 24.0),
|
|
|
- child: Text(
|
|
|
- "${NumberFormat().format(_userDetails.fileCount)} Memories",
|
|
|
- style: Theme.of(context)
|
|
|
- .textTheme
|
|
|
- .headline5
|
|
|
- .copyWith(color: Colors.white, fontSize: 14),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
+ ),
|
|
|
+ Padding(padding: EdgeInsets.only(right: 4)),
|
|
|
+ Text(
|
|
|
+ "Family",
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText1
|
|
|
+ .copyWith(color: Colors.white),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ : Text(
|
|
|
+ "${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage())} used",
|
|
|
+ style: Theme.of(context).textTheme.headline5.copyWith(
|
|
|
+ color: Colors.white.withOpacity(0.7), fontSize: 14),
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.only(right: 24.0),
|
|
|
+ child: Text(
|
|
|
+ "${NumberFormat().format(_userDetails.fileCount)} Memories",
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .headline5
|
|
|
+ .copyWith(color: Colors.white, fontSize: 14),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
],
|
|
|
),
|
|
|
),
|