Skip to content

Commit f061c19

Browse files
committed
clean up styles for demo app
1 parent a8827c5 commit f061c19

File tree

10 files changed

+74
-68
lines changed

10 files changed

+74
-68
lines changed

examples/demo/lib/screens/home_screen.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ class _HomeScreenState extends State<HomeScreen> {
8181
),
8282
),
8383
const SizedBox(width: 8),
84-
const Text(
84+
Text(
8585
'Sample App',
86-
style: TextStyle(
87-
fontSize: 14,
88-
fontWeight: FontWeight.w400,
89-
),
86+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
87+
color: Colors.white,
88+
),
9089
),
9190
],
9291
),

examples/demo/lib/theme.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ class AppSpacing {
1111
class AppColors {
1212
static const oneSignalRed = Color(0xFFE54B4D);
1313
static const oneSignalGreen = Color(0xFF34A853);
14-
static const oneSignalGreenLight = Color(0xFFE6F4EA);
1514
static const lightBackground = Color(0xFFF8F9FA);
1615
static const cardBackground = Colors.white;
1716
static const dividerColor = Color(0xFFE8EAED);
1817
static const warningBackground = Color(0xFFFFF8E1);
18+
static const sectionHeaderText = Color(0xFF616161);
19+
static const subtleText = Color(0xFF757575);
1920

2021
AppColors._();
2122
}

examples/demo/lib/widgets/dialogs.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:convert';
33
import 'package:flutter/material.dart';
44

55
import '../services/tooltip_helper.dart';
6+
import '../theme.dart';
67

78
// Single input dialog (login, email, sms)
89
class SingleInputDialog extends StatefulWidget {
@@ -702,11 +703,15 @@ class TooltipDialog extends StatelessWidget {
702703
children: [
703704
Text(
704705
option.name,
705-
style: const TextStyle(fontWeight: FontWeight.bold),
706+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
707+
fontWeight: FontWeight.bold,
708+
),
706709
),
707710
Text(
708711
option.description,
709-
style: TextStyle(color: Colors.grey[600]),
712+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
713+
color: AppColors.subtleText,
714+
),
710715
),
711716
],
712717
),

examples/demo/lib/widgets/list_widgets.dart

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'package:flutter/material.dart';
22

3+
import '../theme.dart';
4+
35
class PairItem extends StatelessWidget {
46
final String keyText;
57
final String valueText;
@@ -24,25 +26,23 @@ class PairItem extends StatelessWidget {
2426
children: [
2527
Text(
2628
keyText,
27-
style: const TextStyle(
28-
fontWeight: FontWeight.w500,
29-
fontSize: 14,
30-
),
29+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
30+
fontWeight: FontWeight.w500,
31+
),
3132
),
3233
Text(
3334
valueText,
34-
style: TextStyle(
35-
fontSize: 13,
36-
color: Colors.grey[600],
37-
),
35+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
36+
color: AppColors.subtleText,
37+
),
3838
),
3939
],
4040
),
4141
),
4242
if (onDelete != null)
4343
GestureDetector(
4444
onTap: onDelete,
45-
child: Icon(Icons.close, size: 18, color: Colors.grey[500]),
45+
child: Icon(Icons.close, size: 18, color: AppColors.sectionHeaderText),
4646
),
4747
],
4848
),
@@ -66,11 +66,11 @@ class SingleItem extends StatelessWidget {
6666
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 4),
6767
child: Row(
6868
children: [
69-
Expanded(child: Text(text, style: const TextStyle(fontSize: 14))),
69+
Expanded(child: Text(text, style: Theme.of(context).textTheme.bodyMedium)),
7070
if (onDelete != null)
7171
GestureDetector(
7272
onTap: onDelete,
73-
child: Icon(Icons.close, size: 18, color: Colors.grey[500]),
73+
child: Icon(Icons.close, size: 18, color: AppColors.sectionHeaderText),
7474
),
7575
],
7676
),
@@ -90,7 +90,9 @@ class EmptyState extends StatelessWidget {
9090
child: Center(
9191
child: Text(
9292
text,
93-
style: TextStyle(color: Colors.grey[400], fontSize: 14),
93+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
94+
color: AppColors.subtleText,
95+
),
9496
),
9597
),
9698
);

examples/demo/lib/widgets/section_card.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SectionCard extends StatelessWidget {
3131
title.toUpperCase(),
3232
style: Theme.of(context).textTheme.bodySmall?.copyWith(
3333
fontWeight: FontWeight.bold,
34-
color: Colors.grey[700],
34+
color: AppColors.sectionHeaderText,
3535
letterSpacing: 0.5,
3636
),
3737
),
@@ -42,7 +42,7 @@ class SectionCard extends StatelessWidget {
4242
child: Icon(
4343
Icons.info_outline,
4444
size: 18,
45-
color: Colors.grey[500],
45+
color: AppColors.sectionHeaderText,
4646
),
4747
),
4848
],

examples/demo/lib/widgets/sections/app_section.dart

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ class AppSection extends StatelessWidget {
3434
Expanded(
3535
child: SelectableText(
3636
vm.appId,
37-
style: const TextStyle(
38-
fontFamily: 'monospace',
39-
fontSize: 12,
40-
),
37+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
38+
fontFamily: 'monospace',
39+
),
4140
textAlign: TextAlign.end,
4241
),
4342
),
@@ -48,38 +47,38 @@ class AppSection extends StatelessWidget {
4847
AppSpacing.gapBox,
4948

5049
// Guidance banner
51-
Container(
50+
SizedBox(
5251
width: double.infinity,
53-
padding: const EdgeInsets.all(12),
54-
decoration: BoxDecoration(
52+
child: Card(
5553
color: AppColors.warningBackground,
56-
borderRadius: BorderRadius.circular(8),
57-
),
58-
child: Column(
59-
crossAxisAlignment: CrossAxisAlignment.start,
60-
children: [
61-
const Text(
62-
'Add your own App ID, then rebuild to fully test all functionality.',
63-
style: TextStyle(fontSize: 13),
64-
),
65-
AppSpacing.gapBox,
66-
GestureDetector(
67-
onTap: () => launchUrl(
68-
Uri.parse('https://onesignal.com'),
69-
mode: LaunchMode.externalApplication,
54+
margin: EdgeInsets.zero,
55+
child: Padding(
56+
padding: const EdgeInsets.all(12),
57+
child: Column(
58+
crossAxisAlignment: CrossAxisAlignment.start,
59+
children: [
60+
Text(
61+
'Add your own App ID, then rebuild to fully test all functionality.',
62+
style: Theme.of(context).textTheme.bodySmall,
7063
),
71-
child: Text(
72-
'Get your keys at onesignal.com',
73-
style: TextStyle(
74-
fontSize: 13,
75-
color: Theme.of(context).colorScheme.primary,
76-
decoration: TextDecoration.underline,
64+
GestureDetector(
65+
onTap: () => launchUrl(
66+
Uri.parse('https://onesignal.com'),
67+
mode: LaunchMode.externalApplication,
68+
),
69+
child: Text(
70+
'Get your keys at onesignal.com',
71+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
72+
color: AppColors.oneSignalRed,
73+
fontWeight: FontWeight.w600,
74+
),
7775
),
7876
),
79-
),
80-
],
77+
],
78+
),
8179
),
8280
),
81+
),
8382
AppSpacing.gapBox,
8483

8584
// Consent card

examples/demo/lib/widgets/sections/push_section.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ class PushSection extends StatelessWidget {
3737
Expanded(
3838
child: SelectableText(
3939
vm.pushSubscriptionId ?? 'N/A',
40-
style: const TextStyle(
41-
fontFamily: 'monospace',
42-
fontSize: 12,
43-
),
40+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
41+
fontFamily: 'monospace',
42+
),
4443
textAlign: TextAlign.end,
4544
),
4645
),

examples/demo/lib/widgets/sections/send_iam_section.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SendIamSection extends StatelessWidget {
2626
child: ElevatedButton(
2727
onPressed: () => vm.sendInAppMessage(type),
2828
style: ElevatedButton.styleFrom(
29-
backgroundColor: const Color(0xFFE9444E),
29+
backgroundColor: AppColors.oneSignalRed,
3030
foregroundColor: Colors.white,
3131
minimumSize: const Size(double.infinity, 48),
3232
shape: RoundedRectangleBorder(

examples/demo/lib/widgets/sections/user_section.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,29 @@ class UserSection extends StatelessWidget {
3131
Row(
3232
mainAxisAlignment: MainAxisAlignment.spaceBetween,
3333
children: [
34-
const Text('Status', style: TextStyle(fontSize: 14)),
34+
Text('Status', style: Theme.of(context).textTheme.bodyMedium),
3535
Text(
3636
vm.isLoggedIn ? 'Logged In' : 'Anonymous',
37-
style: TextStyle(
38-
fontSize: 14,
39-
fontWeight: FontWeight.w500,
40-
color: vm.isLoggedIn
41-
? AppColors.oneSignalGreen
42-
: Colors.grey[600],
43-
),
37+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
38+
fontWeight: FontWeight.w500,
39+
color: vm.isLoggedIn
40+
? AppColors.oneSignalGreen
41+
: AppColors.subtleText,
42+
),
4443
),
4544
],
4645
),
4746
const Divider(),
4847
Row(
4948
mainAxisAlignment: MainAxisAlignment.spaceBetween,
5049
children: [
51-
const Text(
50+
Text(
5251
'External ID',
53-
style: TextStyle(fontSize: 14),
52+
style: Theme.of(context).textTheme.bodyMedium,
5453
),
5554
SelectableText(
5655
vm.isLoggedIn ? (vm.externalUserId ?? '') : '–',
57-
style: const TextStyle(fontSize: 14),
56+
style: Theme.of(context).textTheme.bodyMedium,
5857
),
5958
],
6059
),

examples/demo/lib/widgets/toggle_row.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'package:flutter/material.dart';
22

3+
import '../theme.dart';
4+
35
class ToggleRow extends StatelessWidget {
46
final String label;
57
final String? description;
@@ -27,7 +29,7 @@ class ToggleRow extends StatelessWidget {
2729
Text(
2830
description!,
2931
style: Theme.of(context).textTheme.bodySmall?.copyWith(
30-
color: Colors.grey[600],
32+
color: AppColors.subtleText,
3133
),
3234
),
3335
],

0 commit comments

Comments
 (0)