feat:更新主题色有些失效的场景
This commit is contained in:
@@ -7,7 +7,7 @@ class AppDrawer extends StatelessWidget {
|
|||||||
|
|
||||||
DrawerHeader buildDrawerHeader(BuildContext context) {
|
DrawerHeader buildDrawerHeader(BuildContext context) {
|
||||||
return DrawerHeader(
|
return DrawerHeader(
|
||||||
decoration: BoxDecoration(color: Theme.of(context).primaryColor),
|
decoration: BoxDecoration(color: Theme.of(context).colorScheme.primary),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ void showAwesomeDialog({
|
|||||||
dialogType: DialogType.noHeader,
|
dialogType: DialogType.noHeader,
|
||||||
animType: AnimType.scale,
|
animType: AnimType.scale,
|
||||||
body: body,
|
body: body,
|
||||||
dialogBackgroundColor: Colors.white,
|
dialogBackgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
btnOkText: "确认",
|
btnOkText: "确认",
|
||||||
btnCancelText: "取消",
|
btnCancelText: "取消",
|
||||||
btnOkColor: Colors.orange,
|
btnOkColor: Colors.orange,
|
||||||
@@ -25,7 +25,7 @@ void showAwesomeDialog({
|
|||||||
onPressed: onOk,
|
onPressed: onOk,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ void buildModalBottom({
|
|||||||
required String title,
|
required String title,
|
||||||
required Widget body,
|
required Widget body,
|
||||||
}) {
|
}) {
|
||||||
|
final colors = Theme.of(context).colorScheme;
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
@@ -52,7 +54,11 @@ void buildModalBottom({
|
|||||||
builder: (_, controller) {
|
builder: (_, controller) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: colors.surface,
|
||||||
|
border: Border.all(
|
||||||
|
color: colors.outline.withAlpha(50),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
topLeft: Radius.circular(24),
|
topLeft: Radius.circular(24),
|
||||||
topRight: Radius.circular(24),
|
topRight: Radius.circular(24),
|
||||||
@@ -69,6 +75,25 @@ void buildModalBottom({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildModalBottomTitle(BuildContext context, String title) {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget buildModalBottomBody(BuildContext context, String title, Widget body) {
|
Widget buildModalBottomBody(BuildContext context, String title, Widget body) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -82,23 +107,8 @@ Widget buildModalBottomBody(BuildContext context, String title, Widget body) {
|
|||||||
borderRadius: BorderRadius.circular(2),
|
borderRadius: BorderRadius.circular(2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
buildModalBottomTitle(context, title),
|
||||||
// 标题栏
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Divider(height: 1, thickness: 1),
|
Divider(height: 1, thickness: 1),
|
||||||
|
|
||||||
Expanded(child: Padding(padding: EdgeInsets.all(12), child: body)),
|
Expanded(child: Padding(padding: EdgeInsets.all(12), child: body)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class _FlispFormState extends State<FlispForm> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final int maxContentCount = 100;
|
final int maxContentCount = 100;
|
||||||
final provider = Provider.of<FlispProvider>(context);
|
final provider = Provider.of<FlispProvider>(context);
|
||||||
|
final colors = Theme.of(context).colorScheme;
|
||||||
|
|
||||||
Widget buildContentField() {
|
Widget buildContentField() {
|
||||||
return FormBuilderTextField(
|
return FormBuilderTextField(
|
||||||
@@ -90,10 +91,10 @@ class _FlispFormState extends State<FlispForm> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(color: Colors.orange),
|
borderSide: BorderSide(color: colors.primary),
|
||||||
),
|
),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.white,
|
fillColor: colors.surface,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||||
),
|
),
|
||||||
minLines: 4,
|
minLines: 4,
|
||||||
@@ -193,7 +194,7 @@ class _FlispFormState extends State<FlispForm> {
|
|||||||
width: 48,
|
width: 48,
|
||||||
height: 48,
|
height: 48,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).primaryColor,
|
color: colors.primary,
|
||||||
borderRadius: BorderRadius.circular(24),
|
borderRadius: BorderRadius.circular(24),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
|||||||
@@ -32,13 +32,14 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
final int maxTitleCount = 10;
|
final int maxTitleCount = 10;
|
||||||
final int maxContentCount = 20;
|
final int maxContentCount = 20;
|
||||||
final provider = Provider.of<TodoProvider>(context);
|
final provider = Provider.of<TodoProvider>(context);
|
||||||
|
final colors = Theme.of(context).colorScheme;
|
||||||
|
|
||||||
Widget buildTitle() {
|
Widget buildTitle() {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
widget.isEditing ? Icons.edit_note : Icons.add_task,
|
widget.isEditing ? Icons.edit_note : Icons.add_task,
|
||||||
color: Theme.of(context).primaryColor,
|
color: colors.primary,
|
||||||
size: 24,
|
size: 24,
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
@@ -47,7 +48,7 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context).primaryColor,
|
color: colors.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -67,10 +68,7 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
label: RichText(
|
label: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: '标题',
|
text: '标题',
|
||||||
style: TextStyle(
|
style: TextStyle(color: Colors.grey.shade700, fontSize: 16),
|
||||||
color: Colors.grey.shade700,
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
children: const [
|
children: const [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '*',
|
text: '*',
|
||||||
@@ -96,10 +94,10 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(color: Colors.orange),
|
borderSide: BorderSide(color: colors.primary),
|
||||||
),
|
),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.white,
|
fillColor: colors.surface,
|
||||||
prefixIcon: Icon(Icons.title, color: Colors.blue),
|
prefixIcon: Icon(Icons.title, color: Colors.blue),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||||
),
|
),
|
||||||
@@ -140,10 +138,10 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(color: Colors.orange),
|
borderSide: BorderSide(color: colors.primary),
|
||||||
),
|
),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.white,
|
fillColor: colors.surface,
|
||||||
prefixIcon: Icon(Icons.description, color: Colors.green),
|
prefixIcon: Icon(Icons.description, color: Colors.green),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||||
),
|
),
|
||||||
@@ -203,10 +201,10 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(color: Colors.orange),
|
borderSide: BorderSide(color: colors.primary),
|
||||||
),
|
),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.white,
|
fillColor: colors.surface,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||||
suffixIcon:
|
suffixIcon:
|
||||||
provider.formItem.dueDate != null
|
provider.formItem.dueDate != null
|
||||||
@@ -268,10 +266,10 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(color: Colors.orange),
|
borderSide: BorderSide(color: colors.primary),
|
||||||
),
|
),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.white,
|
fillColor: colors.surface,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||||
suffixIcon:
|
suffixIcon:
|
||||||
provider.formItem.scheduledTime != null
|
provider.formItem.scheduledTime != null
|
||||||
@@ -320,7 +318,7 @@ class _TodoFormState extends State<TodoForm> {
|
|||||||
Container buildPriorityField() {
|
Container buildPriorityField() {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: colors.surface,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
border: Border.all(color: Colors.grey.shade300, width: 1),
|
border: Border.all(color: Colors.grey.shade300, width: 1),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user