File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,8 @@ class _MyHomePageState extends State<MyHomePage> {
115
115
}
116
116
117
117
void changePrimaryColor () {
118
- String text = 'FF' + primaryColorController.text.replaceAll ('#' , '' );
119
- Color color = Color (int .parse (text, radix: 16 ));
120
- Instabug .setPrimaryColor (color);
118
+ String text = primaryColorController.text.replaceAll ('#' , '' );
119
+ Instabug .setTheme (ThemeConfig (primaryColor: '#$text ' ));
121
120
}
122
121
123
122
void setColorTheme (ColorTheme colorTheme) {
Original file line number Diff line number Diff line change @@ -433,4 +433,24 @@ void main() {
433
433
mHost.willRedirectToStore (),
434
434
).called (1 );
435
435
});
436
+
437
+ test ('[setTheme] should call host method with theme config' , () async {
438
+ const themeConfig = ThemeConfig (primaryColor: '#FF0000' );
439
+
440
+ await Instabug .setTheme (themeConfig);
441
+
442
+ verify (
443
+ mHost.setTheme (themeConfig.toMap ()),
444
+ ).called (1 );
445
+ });
446
+
447
+ test ('[setPrimaryColor] should call setTheme with primary color' , () async {
448
+ const color = Color (0xFFFF0000 );
449
+
450
+ await Instabug .setPrimaryColor (color);
451
+
452
+ verify (
453
+ mHost.setTheme (any),
454
+ ).called (1 );
455
+ });
436
456
}
You can’t perform that action at this time.
0 commit comments