Merge pull request #62 from cake-tech/CWA-216-new-settings-screen

Cwa 216 new settings screen
This commit is contained in:
Oleksandr Sobol
2020-05-25 18:32:42 +03:00
committed by GitHub
14 changed files with 683 additions and 674 deletions
+100 -81
View File
@@ -1,19 +1,23 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class Picker<Item extends Object> extends StatelessWidget {
Picker(
{@required this.selectedAtIndex,
@required this.items,
@required this.title,
this.pickerHeight = 300,
this.onItemSelected});
Picker({
@required this.selectedAtIndex,
@required this.items,
this.images,
@required this.title,
@required this.onItemSelected,
this.mainAxisAlignment = MainAxisAlignment.start
});
final int selectedAtIndex;
final List<Item> items;
final List<Image> images;
final String title;
final double pickerHeight;
final Function(Item) onItemSelected;
final MainAxisAlignment mainAxisAlignment;
@override
Widget build(BuildContext context) {
@@ -24,83 +28,98 @@ class Picker<Item extends Object> extends StatelessWidget {
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.55)),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () => null,
child: Container(
width: double.infinity,
height: pickerHeight,
color: Theme.of(context).backgroundColor,
child: ListView.separated(
itemCount: items.length + 1,
separatorBuilder: (_, index) => index == 0
? SizedBox()
: Divider(
height: 1,
color: Color.fromRGBO(235, 238, 242, 1)),
itemBuilder: (_, index) {
if (index == 0) {
return Container(
height: 100,
width: double.infinity,
color: Theme.of(context).backgroundColor,
child: Center(
child: Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.w600,
fontFamily: 'Lato',
decoration: TextDecoration.none,
color: Theme.of(context)
.primaryTextTheme
.caption
.color),
decoration: BoxDecoration(color: PaletteDark.historyPanel.withOpacity(0.75)),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 24, right: 24),
child: Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.white
),
),
),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
child: GestureDetector(
onTap: () => null,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
height: 233,
color: PaletteDark.menuList,
child: ListView.separated(
separatorBuilder: (context, index) => Divider(
color: PaletteDark.mainBackgroundColor,
height: 1,
),
),
);
}
itemCount: items == null ? 0 : items.length,
itemBuilder: (context, index) {
final item = items[index];
final image = images != null? images[index] : null;
final isItemSelected = index == selectedAtIndex;
index -= 1;
final item = items[index];
final color = isItemSelected
? PaletteDark.menuHeader
: Colors.transparent;
final textColor = isItemSelected
? Colors.blue
: Colors.white;
return GestureDetector(
onTap: () {
if (onItemSelected == null) {
return;
}
Navigator.of(context).pop();
onItemSelected(item);
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.only(top: 18, bottom: 18),
child: Center(
child: Text(
item.toString(),
style: TextStyle(
decoration: TextDecoration.none,
fontSize: 18,
fontWeight: FontWeight.normal,
fontFamily: 'Lato',
color: index == selectedAtIndex
? Color.fromRGBO(138, 80, 255, 1)
: Theme.of(context)
.primaryTextTheme
.caption
.color),
)),
),
);
},
)),
)
],
),
return GestureDetector(
onTap: () {
if (onItemSelected == null) {
return;
}
Navigator.of(context).pop();
onItemSelected(item);
},
child: Container(
height: 77,
padding: EdgeInsets.only(left: 24, right: 24),
color: color,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image != null
? image
: Offstage(),
Padding(
padding: EdgeInsets.only(
left: image != null ? 12 : 0
),
child: Text(
item.toString(),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: textColor,
decoration: TextDecoration.none,
),
),
)
],
),
),
);
},
)
),
),
),
)
],
),
)
),
),
),
+13 -18
View File
@@ -1,3 +1,5 @@
import 'package:cake_wallet/palette.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StandartSwitch extends StatefulWidget {
@@ -16,29 +18,22 @@ class StandartSwitchState extends State<StandartSwitch> {
return GestureDetector(
onTap: widget.onTaped,
child: AnimatedContainer(
padding: EdgeInsets.only(left: 4.0, right: 4.0),
padding: EdgeInsets.only(left: 2.0, right: 2.0),
alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft,
duration: Duration(milliseconds: 250),
width: 55.0,
height: 33.0,
width: 50,
height: 28,
decoration: BoxDecoration(
color: Theme.of(context).toggleButtonsTheme.color,
border: Border.all(
color: Theme.of(context).toggleButtonsTheme.borderColor),
borderRadius: BorderRadius.all(Radius.circular(10.0))),
color: widget.value
? Colors.green
: PaletteDark.mainBackgroundColor,
borderRadius: BorderRadius.all(Radius.circular(14.0))),
child: Container(
width: 25.0,
height: 25.0,
width: 24.0,
height: 24.0,
decoration: BoxDecoration(
color: widget.value
? Theme.of(context).toggleButtonsTheme.selectedColor
: Theme.of(context).toggleButtonsTheme.disabledColor,
borderRadius: BorderRadius.all(Radius.circular(8.0))),
child: Icon(
widget.value ? Icons.check : Icons.close,
color: Colors.white,
size: 16.0,
),
color: Colors.white,
shape: BoxShape.circle),
),
),
);