Skip to content

Commit 2974837

Browse files
committed
Apply several enhancements
1 parent bf6665e commit 2974837

8 files changed

+139
-191
lines changed

example/lib/models/app_theme.dart

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
import 'package:flutter/material.dart';
22

3+
abstract class AppColors {
4+
static const primaryColor = Color(0xFF00287a);
5+
static const secondaryColor = Color(0xFF5DAAF0);
6+
static const primaryColorDark = Color(0xFF212121);
7+
}
8+
39
class AppTheme {
410
static final lightTheme = ThemeData(
511
colorScheme: ColorScheme.fromSwatch().copyWith(
612
brightness: Brightness.light,
7-
primary: const Color(0xFF00287a),
8-
secondary: const Color(0xFF5DAAF0),
13+
primary: AppColors.primaryColor,
14+
secondary: AppColors.secondaryColor,
915
),
1016
scaffoldBackgroundColor: Colors.grey[100],
1117
appBarTheme: const AppBarTheme(
12-
color: Color(0xFF00287a),
18+
color: AppColors.primaryColor,
1319
),
1420
visualDensity: VisualDensity.adaptivePlatformDensity,
1521
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
16-
backgroundColor: Color(0xFF00287a),
22+
backgroundColor: AppColors.primaryColor,
1723
unselectedItemColor: Colors.white,
18-
selectedItemColor: Color(0xFF5DAAF0),
24+
selectedItemColor: AppColors.secondaryColor,
1925
),
2026
chipTheme: const ChipThemeData(
21-
selectedColor: Color(0xFF5DAAF0),
27+
selectedColor: AppColors.secondaryColor,
2228
),
2329
iconTheme: IconThemeData(color: Colors.grey[600]),
2430
textTheme: const TextTheme(
2531
headlineMedium: TextStyle(
2632
fontFamily: 'Axiforma',
2733
fontSize: 16.0,
28-
color: Color(0xFF00287a),
34+
color: AppColors.primaryColor,
2935
fontWeight: FontWeight.w600,
3036
),
3137
),
3238
);
3339

3440
static final darkTheme = ThemeData.dark().copyWith(
3541
colorScheme: ColorScheme.fromSwatch().copyWith(
36-
secondary: const Color(0xFF5DAAF0),
42+
secondary: AppColors.secondaryColor,
3743
),
3844
appBarTheme: const AppBarTheme(
39-
color: Color(0xFF212121),
45+
color: AppColors.primaryColorDark,
4046
),
4147
visualDensity: VisualDensity.adaptivePlatformDensity,
4248
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
43-
backgroundColor: Color(0xFF212121),
49+
backgroundColor: AppColors.primaryColorDark,
4450
),
4551
chipTheme: const ChipThemeData(
46-
selectedColor: Color(0xFF5DAAF0),
52+
selectedColor: AppColors.secondaryColor,
4753
backgroundColor: Color(0xFFB3B3B3),
4854
),
4955
iconTheme: const IconThemeData(color: Colors.white),

example/lib/providers/bug_reporting_state.dart

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,95 +3,77 @@ import 'package:flutter/material.dart';
33
import 'package:instabug_flutter/instabug_flutter.dart';
44

55
class BugReportingState with ChangeNotifier {
6-
final _extraAttachments = {
6+
var _extraAttachments = {
77
'Screenshot': true,
88
'Extra Screenshot': true,
99
'Gallery Image': true,
1010
'Screen Recording': true
1111
};
1212
Map<String, bool> get extraAttachments => _extraAttachments;
13+
set extraAttachments(Map<String, bool> attachments) {
14+
_extraAttachments = attachments;
15+
notifyListeners();
16+
}
1317

1418
var _selectedInvocationOptions = <InvocationOption>{};
15-
final _invocationOptions = {
16-
InvocationOption.commentFieldRequired: 'Comment Required',
17-
InvocationOption.emailFieldHidden: 'Email Hidden',
18-
InvocationOption.emailFieldOptional: 'Email Optional',
19-
InvocationOption.disablePostSendingDialog: 'Disable Post Sending Dialog',
20-
};
2119
Set<InvocationOption> get selectedInvocationOptions =>
2220
_selectedInvocationOptions;
23-
set selectedInvocationOptions(Set<InvocationOption> value) {
24-
_selectedInvocationOptions = value;
21+
set selectedInvocationOptions(Set<InvocationOption> options) {
22+
_selectedInvocationOptions = options;
2523
notifyListeners();
2624
}
2725

28-
Map<InvocationOption, String> get invocationOptions => _invocationOptions;
29-
3026
var _selectedInvocationEvents = <InvocationEvent>{
3127
InvocationEvent.floatingButton
3228
};
33-
final _invocationEvents = {
34-
InvocationEvent.floatingButton: 'Floating Button',
35-
InvocationEvent.shake: 'Shake',
36-
InvocationEvent.screenshot: 'Screenshot',
37-
InvocationEvent.twoFingersSwipeLeft: 'Two Finger Swipe Left',
38-
InvocationEvent.none: 'None',
39-
};
4029
Set<InvocationEvent> get selectedInvocationEvents =>
4130
_selectedInvocationEvents;
42-
set selectedInvocationEvents(Set<InvocationEvent> value) {
43-
_selectedInvocationEvents = value;
31+
set selectedInvocationEvents(Set<InvocationEvent> events) {
32+
_selectedInvocationEvents = events;
4433
notifyListeners();
4534
}
4635

47-
Map<InvocationEvent, String> get invocationEvents => _invocationEvents;
48-
49-
var _selectedExtendedMode = 'Disabled';
50-
final _extendedMode = {
51-
ExtendedBugReportMode.disabled: 'Disabled',
52-
ExtendedBugReportMode.enabledWithOptionalFields: 'Optional Fields',
53-
ExtendedBugReportMode.enabledWithRequiredFields: 'Required Fields',
54-
};
55-
String get selectedExtendedMode => _selectedExtendedMode;
56-
set selectedExtendedMode(String value) {
57-
_selectedExtendedMode = value;
36+
var _selectedExtendedMode = ExtendedBugReportMode.disabled;
37+
ExtendedBugReportMode get selectedExtendedMode => _selectedExtendedMode;
38+
set selectedExtendedMode(ExtendedBugReportMode mode) {
39+
_selectedExtendedMode = mode;
5840
notifyListeners();
5941
}
6042

61-
Map<ExtendedBugReportMode, String> get extendedMode => _extendedMode;
62-
63-
var _selectedVideoRecordingPosition = 'Bottom Right';
64-
final _videoRecordingPosition = {
65-
Position.topLeft: 'Top Left',
66-
Position.topRight: 'Top Right',
67-
Position.bottomLeft: 'Bottom Left',
68-
Position.bottomRight: 'Bottom Right',
69-
};
70-
String get selectedVideoRecordingPosition => _selectedVideoRecordingPosition;
71-
set selectedVideoRecordingPosition(String value) {
72-
_selectedVideoRecordingPosition = value;
43+
var _selectedVideoRecordingPosition = Position.bottomRight;
44+
Position get selectedVideoRecordingPosition =>
45+
_selectedVideoRecordingPosition;
46+
set selectedVideoRecordingPosition(Position position) {
47+
_selectedVideoRecordingPosition = position;
7348
notifyListeners();
7449
}
7550

76-
Map<Position, String> get videoRecordingPosition => _videoRecordingPosition;
51+
var _selectedFloatingButtonEdge = FloatingButtonEdge.right;
52+
FloatingButtonEdge get selectedFloatingButtonEdge =>
53+
_selectedFloatingButtonEdge;
54+
set selectedFloatingButtonEdge(FloatingButtonEdge edge) {
55+
_selectedFloatingButtonEdge = edge;
56+
notifyListeners();
57+
}
7758

78-
var _selectedFloatingButtonEdge = 'Right';
79-
var _selectedFloatingButtonOffset = 100;
80-
final _floatingButtonEdge = {
81-
FloatingButtonEdge.right: 'Right',
82-
FloatingButtonEdge.left: 'Left',
83-
};
84-
String get selectedFloatingButtonEdge => _selectedFloatingButtonEdge;
85-
set selectedFloatingButtonEdge(String value) {
86-
_selectedFloatingButtonEdge = value;
59+
var _disclaimerText = '';
60+
String get disclaimerText => _disclaimerText;
61+
set disclaimerText(String text) {
62+
_disclaimerText = text;
8763
notifyListeners();
8864
}
8965

90-
Map<FloatingButtonEdge, String> get floatingButtonEdge => _floatingButtonEdge;
66+
var _characterCount = '';
67+
String get characterCount => _characterCount;
68+
set characterCount(String count) {
69+
_characterCount = count;
70+
notifyListeners();
71+
}
9172

92-
int get selectedFloatingButtonOffset => _selectedFloatingButtonOffset;
93-
set selectedFloatingButtonOffset(int value) {
94-
_selectedFloatingButtonOffset = value;
73+
var _floatingButtonOffset = 100;
74+
int get floatingButtonOffset => _floatingButtonOffset;
75+
set floatingButtonOffset(int offset) {
76+
_floatingButtonOffset = offset;
9577
notifyListeners();
9678
}
9779
}

0 commit comments

Comments
 (0)