Skip to content

Commit

Permalink
fix: material dark mode text
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Feb 1, 2020
1 parent 559d675 commit a4284d0
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 25 deletions.
47 changes: 24 additions & 23 deletions lib/models/theme.dart
Expand Up @@ -224,6 +224,7 @@ class ThemeModel with ChangeNotifier {
Future<bool> showConfirm(BuildContext context, Widget content) {
switch (theme) {
case AppThemeType.cupertino:
default:
return showCupertinoDialog(
context: context,
builder: (context) {
Expand All @@ -247,29 +248,29 @@ class ThemeModel with ChangeNotifier {
);
},
);
default:
return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: content,
actions: <Widget>[
FlatButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.pop(context, false);
},
),
FlatButton(
child: const Text('OK'),
onPressed: () {
Navigator.pop(context, true);
},
)
],
);
},
);
// default:
// return showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// content: content,
// actions: <Widget>[
// FlatButton(
// child: const Text('CANCEL'),
// onPressed: () {
// Navigator.pop(context, false);
// },
// ),
// FlatButton(
// child: const Text('OK'),
// onPressed: () {
// Navigator.pop(context, true);
// },
// )
// ],
// );
// },
// );
}
}

Expand Down
3 changes: 3 additions & 0 deletions lib/screens/issue_form.dart
Expand Up @@ -22,13 +22,15 @@ class _IssueFormScreenState extends State<IssueFormScreen> {

@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
return CommonScaffold(
title: Text('Submit an issue'),
body: Column(
children: <Widget>[
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
placeholder: 'Title',
onChanged: (v) {
setState(() {
Expand All @@ -40,6 +42,7 @@ class _IssueFormScreenState extends State<IssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
placeholder: 'Body',
onChanged: (v) {
setState(() {
Expand Down
5 changes: 3 additions & 2 deletions lib/screens/login.dart
Expand Up @@ -6,6 +6,7 @@ import 'package:git_touch/scaffolds/single.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_button.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/text_field.dart';
import 'package:provider/provider.dart';
import '../widgets/link.dart';
import '../widgets/loading.dart';
Expand Down Expand Up @@ -95,12 +96,12 @@ class _LoginScreenState extends State<LoginScreen> {
return Column(
children: <Widget>[
if (showDomain)
CupertinoTextField(
MyTextField(
controller: _domainController,
placeholder: 'Domain',
),
SizedBox(height: 8),
CupertinoTextField(
MyTextField(
placeholder: 'Access token',
controller: _tokenController,
),
Expand Down
32 changes: 32 additions & 0 deletions lib/widgets/text_field.dart
@@ -0,0 +1,32 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart';

class MyTextField extends StatelessWidget {
final TextEditingController controller;
final String placeholder;
MyTextField({@required this.controller, this.placeholder});

@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
switch (theme.theme) {
case AppThemeType.cupertino:
default:
return CupertinoTextField(
controller: controller,
placeholder: placeholder,
style: TextStyle(color: theme.palette.text),
);
// default:
// return TextField(
// controller: controller,
// decoration: InputDecoration(
// filled: true,
// labelText: placeholder,
// ),
// );
}
}
}

0 comments on commit a4284d0

Please sign in to comment.