Move all the drawer header code into it

Instead of it being all in a stack.
This commit is contained in:
Vishesh Handa
2020-11-30 22:14:23 +01:00
parent b754c79639
commit 6c5767e2b6
2 changed files with 59 additions and 53 deletions

View File

@ -7,7 +7,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:gitjournal/app_settings.dart'; import 'package:gitjournal/app_settings.dart';
import 'package:gitjournal/features.dart';
class ExperimentalSettingsScreen extends StatefulWidget { class ExperimentalSettingsScreen extends StatefulWidget {
@override @override

View File

@ -11,66 +11,76 @@ class AppDrawerHeader extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var appSettings = Provider.of<AppSettings>(context); var appSettings = Provider.of<AppSettings>(context);
return Stack( var stack = Stack(
children: <Widget>[ children: <Widget>[
DrawerHeader( const Padding(
margin: const EdgeInsets.all(0.0), padding: EdgeInsets.all(16.0),
decoration: BoxDecoration( child: DecoratedBox(
color: Theme.of(context).highlightColor, decoration: BoxDecoration(
), image: DecorationImage(
child: const Padding( image: AssetImage('assets/icon/icon.png'),
padding: EdgeInsets.all(8.0),
child: DecoratedBox(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/icon/icon.png'),
),
), ),
), ),
), ),
), ),
/*
Positioned.fill(
child: Align(
alignment: Alignment.centerLeft,
child: IconButton(
padding: const EdgeInsets.all(0),
icon: Icon(Icons.arrow_left, size: 42.0),
onPressed: () {},
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.centerRight,
child: IconButton(
padding: const EdgeInsets.all(0),
icon: Icon(Icons.arrow_right, size: 42.0),
onPressed: () {},
),
),
),
*/
if (appSettings.proMode) if (appSettings.proMode)
Positioned.fill( Positioned.fill(
child: Align( child: Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: ProButton(), child: Padding(
padding: const EdgeInsets.all(8.0),
child: ProButton(),
),
), ),
), ),
Positioned.fill( Positioned.fill(
child: Align( child: Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: SafeArea( child: SafeArea(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(0, 16, 16, 0), padding: const EdgeInsets.fromLTRB(0, 8, 8, 0),
child: ThemeSwitcherButton(), child: ThemeSwitcherButton(),
)), ),
),
), ),
), ),
], ],
fit: StackFit.passthrough, fit: StackFit.passthrough,
); );
/*
var dropdownValue = 'One';
var repoSelector = DropdownButton<String>(
value: dropdownValue,
icon: const Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String newValue) {
dropdownValue = newValue;
},
items: <String>['One', 'Two', 'Free', 'Four']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
);
*/
return DrawerHeader(
margin: const EdgeInsets.all(0.0),
decoration: BoxDecoration(
color: Theme.of(context).highlightColor,
),
padding: const EdgeInsets.all(8.0),
child: stack,
);
} }
} }
@ -79,19 +89,16 @@ class ProButton extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var theme = Theme.of(context); var theme = Theme.of(context);
return Padding( return Container(
padding: const EdgeInsets.all(16.0), decoration: BoxDecoration(
child: Container( borderRadius: BorderRadius.circular(10),
decoration: BoxDecoration( color: theme.scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(10), boxShadow: [
color: theme.scaffoldBackgroundColor, BoxShadow(color: theme.accentColor, spreadRadius: 0),
boxShadow: [ ],
BoxShadow(color: theme.accentColor, spreadRadius: 0),
],
),
padding: const EdgeInsets.all(8.0),
child: Text('PRO', style: theme.textTheme.button),
), ),
padding: const EdgeInsets.all(8.0),
child: Text('PRO', style: theme.textTheme.button),
); );
} }
} }