|
| 1 | +import 'package:cached_network_image/cached_network_image.dart'; |
| 2 | +/** |
| 3 | + * Author: Damodar Lohani |
| 4 | + * profile: https://github.com/lohanidamodar |
| 5 | + */ |
| 6 | + |
| 7 | +import 'package:flutter/material.dart'; |
| 8 | +import 'package:flutter_ui_challenges/core/presentation/res/assets.dart'; |
| 9 | +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; |
| 10 | + |
| 11 | +class SettingsOnePage extends StatelessWidget { |
| 12 | + static final String path = "lib/src/pages/settings/settings1.dart"; |
| 13 | + @override |
| 14 | + Widget build(BuildContext context) { |
| 15 | + return Scaffold( |
| 16 | + backgroundColor: Colors.grey.shade200, |
| 17 | + appBar: AppBar( |
| 18 | + elevation: 0, |
| 19 | + brightness: Brightness.light, |
| 20 | + iconTheme: IconThemeData(color: Colors.black), |
| 21 | + backgroundColor: Colors.grey.shade200, |
| 22 | + title: Text( |
| 23 | + 'Settings', |
| 24 | + style: TextStyle(color: Colors.black), |
| 25 | + ), |
| 26 | + ), |
| 27 | + body: Stack( |
| 28 | + fit: StackFit.expand, |
| 29 | + children: <Widget>[ |
| 30 | + SingleChildScrollView( |
| 31 | + padding: const EdgeInsets.all(16.0), |
| 32 | + child: Column( |
| 33 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 34 | + children: <Widget>[ |
| 35 | + Card( |
| 36 | + elevation: 8.0, |
| 37 | + shape: RoundedRectangleBorder( |
| 38 | + borderRadius: BorderRadius.circular(10.0)), |
| 39 | + color: Colors.purple, |
| 40 | + child: ListTile( |
| 41 | + onTap: () { |
| 42 | + //open edit profile |
| 43 | + }, |
| 44 | + title: Text( |
| 45 | + "John Doe", |
| 46 | + style: TextStyle( |
| 47 | + color: Colors.white, |
| 48 | + fontWeight: FontWeight.w500, |
| 49 | + ), |
| 50 | + ), |
| 51 | + leading: CircleAvatar( |
| 52 | + backgroundImage: CachedNetworkImageProvider(avatars[0]), |
| 53 | + ), |
| 54 | + trailing: Icon( |
| 55 | + Icons.edit, |
| 56 | + color: Colors.white, |
| 57 | + ), |
| 58 | + ), |
| 59 | + ), |
| 60 | + const SizedBox(height: 10.0), |
| 61 | + Card( |
| 62 | + elevation: 4.0, |
| 63 | + margin: const EdgeInsets.fromLTRB(32.0, 8.0, 32.0, 16.0), |
| 64 | + shape: RoundedRectangleBorder( |
| 65 | + borderRadius: BorderRadius.circular(10.0)), |
| 66 | + child: Column( |
| 67 | + children: <Widget>[ |
| 68 | + ListTile( |
| 69 | + leading: Icon( |
| 70 | + Icons.lock_outline, |
| 71 | + color: Colors.purple, |
| 72 | + ), |
| 73 | + title: Text("Change Password"), |
| 74 | + trailing: Icon(Icons.keyboard_arrow_right), |
| 75 | + onTap: () { |
| 76 | + //open change password |
| 77 | + }, |
| 78 | + ), |
| 79 | + _buildDivider(), |
| 80 | + ListTile( |
| 81 | + leading: Icon( |
| 82 | + FontAwesomeIcons.language, |
| 83 | + color: Colors.purple, |
| 84 | + ), |
| 85 | + title: Text("Change Language"), |
| 86 | + trailing: Icon(Icons.keyboard_arrow_right), |
| 87 | + onTap: () { |
| 88 | + //open change language |
| 89 | + }, |
| 90 | + ), |
| 91 | + _buildDivider(), |
| 92 | + ListTile( |
| 93 | + leading: Icon( |
| 94 | + Icons.location_on, |
| 95 | + color: Colors.purple, |
| 96 | + ), |
| 97 | + title: Text("Change Location"), |
| 98 | + trailing: Icon(Icons.keyboard_arrow_right), |
| 99 | + onTap: () { |
| 100 | + //open change location |
| 101 | + }, |
| 102 | + ), |
| 103 | + ], |
| 104 | + ), |
| 105 | + ), |
| 106 | + const SizedBox(height: 20.0), |
| 107 | + Text( |
| 108 | + "Notification Settings", |
| 109 | + style: TextStyle( |
| 110 | + fontSize: 20.0, |
| 111 | + fontWeight: FontWeight.bold, |
| 112 | + color: Colors.indigo, |
| 113 | + ), |
| 114 | + ), |
| 115 | + SwitchListTile( |
| 116 | + activeColor: Colors.purple, |
| 117 | + contentPadding: const EdgeInsets.all(0), |
| 118 | + value: true, |
| 119 | + title: Text("Received notification"), |
| 120 | + onChanged: (val) {}, |
| 121 | + ), |
| 122 | + SwitchListTile( |
| 123 | + activeColor: Colors.purple, |
| 124 | + contentPadding: const EdgeInsets.all(0), |
| 125 | + value: false, |
| 126 | + title: Text("Received newsletter"), |
| 127 | + onChanged: null, |
| 128 | + ), |
| 129 | + SwitchListTile( |
| 130 | + activeColor: Colors.purple, |
| 131 | + contentPadding: const EdgeInsets.all(0), |
| 132 | + value: true, |
| 133 | + title: Text("Received Offer Notification"), |
| 134 | + onChanged: (val) {}, |
| 135 | + ), |
| 136 | + SwitchListTile( |
| 137 | + activeColor: Colors.purple, |
| 138 | + contentPadding: const EdgeInsets.all(0), |
| 139 | + value: true, |
| 140 | + title: Text("Received App Updates"), |
| 141 | + onChanged: null, |
| 142 | + ), |
| 143 | + const SizedBox(height: 60.0), |
| 144 | + ], |
| 145 | + ), |
| 146 | + ), |
| 147 | + Positioned( |
| 148 | + bottom: -20, |
| 149 | + left: -20, |
| 150 | + child: Container( |
| 151 | + width: 80, |
| 152 | + height: 80, |
| 153 | + alignment: Alignment.center, |
| 154 | + decoration: BoxDecoration( |
| 155 | + color: Colors.purple, |
| 156 | + shape: BoxShape.circle, |
| 157 | + ), |
| 158 | + ), |
| 159 | + ), |
| 160 | + Positioned( |
| 161 | + bottom: 00, |
| 162 | + left: 00, |
| 163 | + child: IconButton( |
| 164 | + icon: Icon( |
| 165 | + FontAwesomeIcons.powerOff, |
| 166 | + color: Colors.white, |
| 167 | + ), |
| 168 | + onPressed: () { |
| 169 | + //log out |
| 170 | + }, |
| 171 | + ), |
| 172 | + ) |
| 173 | + ], |
| 174 | + ), |
| 175 | + ); |
| 176 | + } |
| 177 | + |
| 178 | + Container _buildDivider() { |
| 179 | + return Container( |
| 180 | + margin: const EdgeInsets.symmetric( |
| 181 | + horizontal: 8.0, |
| 182 | + ), |
| 183 | + width: double.infinity, |
| 184 | + height: 1.0, |
| 185 | + color: Colors.grey.shade400, |
| 186 | + ); |
| 187 | + } |
| 188 | +} |
0 commit comments