David PHAM-VAN

Fix icon colors

@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 - Add previewPageMargin and padding parameters [Deepak] 6 - Add previewPageMargin and padding parameters [Deepak]
7 - Fix Scrollbar positionning and default margins 7 - Fix Scrollbar positionning and default margins
8 - Add shouldRepaint parameter 8 - Add shouldRepaint parameter
  9 +- Fix icon colors
9 10
10 ## 5.1.0 11 ## 5.1.0
11 12
@@ -362,19 +362,19 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -362,19 +362,19 @@ class _PdfPreviewState extends State<PdfPreview> {
362 } 362 }
363 363
364 return ListView.builder( 364 return ListView.builder(
365 - controller: scrollController,  
366 - padding: widget.padding,  
367 - itemCount: pages.length,  
368 - itemBuilder: (BuildContext context, int index) => GestureDetector(  
369 - onDoubleTap: () {  
370 - setState(() {  
371 - updatePosition = scrollController.position.pixels;  
372 - preview = index;  
373 - transformationController.value.setIdentity();  
374 - });  
375 - },  
376 - child: pages[index],  
377 - ), 365 + controller: scrollController,
  366 + padding: widget.padding,
  367 + itemCount: pages.length,
  368 + itemBuilder: (BuildContext context, int index) => GestureDetector(
  369 + onDoubleTap: () {
  370 + setState(() {
  371 + updatePosition = scrollController.position.pixels;
  372 + preview = index;
  373 + transformationController.value.setIdentity();
  374 + });
  375 + },
  376 + child: pages[index],
  377 + ),
378 ); 378 );
379 } 379 }
380 380
@@ -396,6 +396,7 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -396,6 +396,7 @@ class _PdfPreviewState extends State<PdfPreview> {
396 @override 396 @override
397 Widget build(BuildContext context) { 397 Widget build(BuildContext context) {
398 final theme = Theme.of(context); 398 final theme = Theme.of(context);
  399 + final iconColor = theme.primaryIconTheme.color ?? Colors.white;
399 400
400 Widget page; 401 Widget page;
401 402
@@ -437,7 +438,6 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -437,7 +438,6 @@ class _PdfPreviewState extends State<PdfPreview> {
437 actions.add( 438 actions.add(
438 IconButton( 439 IconButton(
439 icon: const Icon(Icons.print), 440 icon: const Icon(Icons.print),
440 - color: theme.accentIconTheme.color,  
441 onPressed: _print, 441 onPressed: _print,
442 ), 442 ),
443 ); 443 );
@@ -448,7 +448,6 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -448,7 +448,6 @@ class _PdfPreviewState extends State<PdfPreview> {
448 IconButton( 448 IconButton(
449 key: shareWidget, 449 key: shareWidget,
450 icon: const Icon(Icons.share), 450 icon: const Icon(Icons.share),
451 - color: theme.accentIconTheme.color,  
452 onPressed: _share, 451 onPressed: _share,
453 ), 452 ),
454 ); 453 );
@@ -462,7 +461,7 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -462,7 +461,7 @@ class _PdfPreviewState extends State<PdfPreview> {
462 dropdownColor: theme.primaryColor, 461 dropdownColor: theme.primaryColor,
463 icon: Icon( 462 icon: Icon(
464 Icons.arrow_drop_down, 463 Icons.arrow_drop_down,
465 - color: theme.accentIconTheme.color, 464 + color: iconColor,
466 ), 465 ),
467 value: pageFormat, 466 value: pageFormat,
468 items: List<DropdownMenuItem<PdfPageFormat>>.generate( 467 items: List<DropdownMenuItem<PdfPageFormat>>.generate(
@@ -472,8 +471,7 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -472,8 +471,7 @@ class _PdfPreviewState extends State<PdfPreview> {
472 final val = _pageFormats[key]; 471 final val = _pageFormats[key];
473 return DropdownMenuItem<PdfPageFormat>( 472 return DropdownMenuItem<PdfPageFormat>(
474 value: val, 473 value: val,
475 - child: Text(key,  
476 - style: TextStyle(color: theme.accentIconTheme.color)), 474 + child: Text(key, style: TextStyle(color: iconColor)),
477 ); 475 );
478 }, 476 },
479 ), 477 ),
@@ -490,15 +488,15 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -490,15 +488,15 @@ class _PdfPreviewState extends State<PdfPreview> {
490 488
491 if (widget.canChangeOrientation) { 489 if (widget.canChangeOrientation) {
492 horizontal ??= pageFormat.width > pageFormat.height; 490 horizontal ??= pageFormat.width > pageFormat.height;
493 - final color = theme.accentIconTheme.color!;  
494 - final disabledColor = color.withAlpha(120); 491 +
  492 + final disabledColor = iconColor.withAlpha(120);
495 actions.add( 493 actions.add(
496 ToggleButtons( 494 ToggleButtons(
497 renderBorder: false, 495 renderBorder: false,
498 borderColor: disabledColor, 496 borderColor: disabledColor,
499 color: disabledColor, 497 color: disabledColor,
500 - selectedBorderColor: color,  
501 - selectedColor: color, 498 + selectedBorderColor: iconColor,
  499 + selectedColor: iconColor,
502 onPressed: (int index) { 500 onPressed: (int index) {
503 setState(() { 501 setState(() {
504 horizontal = index == 1; 502 horizontal = index == 1;
@@ -521,7 +519,6 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -521,7 +519,6 @@ class _PdfPreviewState extends State<PdfPreview> {
521 actions.add( 519 actions.add(
522 IconButton( 520 IconButton(
523 icon: action.icon, 521 icon: action.icon,
524 - color: theme.accentIconTheme.color,  
525 onPressed: action.onPressed == null 522 onPressed: action.onPressed == null
526 ? null 523 ? null
527 : () => action.onPressed!( 524 : () => action.onPressed!(
@@ -563,19 +560,23 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -563,19 +560,23 @@ class _PdfPreviewState extends State<PdfPreview> {
563 ? Scrollbar(controller: scrollController, child: scrollView) 560 ? Scrollbar(controller: scrollController, child: scrollView)
564 : scrollView), 561 : scrollView),
565 if (actions.isNotEmpty && widget.useActions) 562 if (actions.isNotEmpty && widget.useActions)
566 - Material(  
567 - elevation: 4,  
568 - color: theme.primaryColor,  
569 - child: SizedBox(  
570 - width: double.infinity,  
571 - child: SafeArea(  
572 - child: Wrap(  
573 - alignment: WrapAlignment.spaceAround,  
574 - children: actions, 563 + IconTheme.merge(
  564 + data: IconThemeData(
  565 + color: iconColor,
  566 + ),
  567 + child: Material(
  568 + elevation: 4,
  569 + color: theme.primaryColor,
  570 + child: SizedBox(
  571 + width: double.infinity,
  572 + child: SafeArea(
  573 + child: Wrap(
  574 + alignment: WrapAlignment.spaceAround,
  575 + children: actions,
  576 + ),
575 ), 577 ),
576 ), 578 ),
577 ), 579 ),
578 - ),  
579 ) 580 )
580 ], 581 ],
581 ); 582 );