mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 09:06:43 +08:00
Move all the drawer header code into it
Instead of it being all in a stack.
This commit is contained in:
@ -7,7 +7,6 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:gitjournal/app_settings.dart';
|
||||
import 'package:gitjournal/features.dart';
|
||||
|
||||
class ExperimentalSettingsScreen extends StatefulWidget {
|
||||
@override
|
||||
|
@ -11,66 +11,76 @@ class AppDrawerHeader extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
var appSettings = Provider.of<AppSettings>(context);
|
||||
|
||||
return Stack(
|
||||
var stack = Stack(
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
margin: const EdgeInsets.all(0.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).highlightColor,
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/icon/icon.png'),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.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)
|
||||
Positioned.fill(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: ProButton(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ProButton(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 16, 16, 0),
|
||||
child: ThemeSwitcherButton(),
|
||||
)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 8, 0),
|
||||
child: ThemeSwitcherButton(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
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) {
|
||||
var theme = Theme.of(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: theme.scaffoldBackgroundColor,
|
||||
boxShadow: [
|
||||
BoxShadow(color: theme.accentColor, spreadRadius: 0),
|
||||
],
|
||||
),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('PRO', style: theme.textTheme.button),
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: theme.scaffoldBackgroundColor,
|
||||
boxShadow: [
|
||||
BoxShadow(color: theme.accentColor, spreadRadius: 0),
|
||||
],
|
||||
),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('PRO', style: theme.textTheme.button),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user