Skip to content

Commit

Permalink
fix display on lower sizes
Browse files Browse the repository at this point in the history
make the blur and spread radius depend on the height and width
of the building bar for the component
  • Loading branch information
immadisairaj committed Jul 11, 2022
1 parent 15e923e commit ca6af77
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.1.1
- Fix number display on lower sizes

## 0.1.0
- Update README
- Update Documentation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ There is no special setup required, just add the dependency in `pubspec.yaml`, i

Add the dependency in `pubspec.yaml`
```yaml
digital_lcd_number: ^0.1.0 # Note: use latest version
digital_lcd_number: ^0.1.1 # Note: use latest version
```
Import the widget into dart file
Expand Down
10 changes: 8 additions & 2 deletions lib/src/lcd_component.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';

/// Bar which acts as the building blocks for the [DigitalLcdNumber].
Expand All @@ -6,6 +8,9 @@ class _BuildingBar extends StatelessWidget {
/// [height], [width] and [barColor].
///
/// It paints a small shadow with 80% of aplha around the bar.
///
/// The spread and blur radius is the minimum of height and width clamped
/// between 1 and 15.
const _BuildingBar({
required this.height,
required this.width,
Expand All @@ -23,13 +28,14 @@ class _BuildingBar extends StatelessWidget {

@override
Widget build(BuildContext context) {
final blurAndSpreadRadius = min(height, width).clamp(1.0, 15.0);
return Container(
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(50), boxShadow: [
BoxShadow(
color: barColor.withAlpha(barColor.alpha ~/ 1.25),
blurRadius: 10.0,
spreadRadius: 10.0,
blurRadius: blurAndSpreadRadius,
spreadRadius: blurAndSpreadRadius,
offset: const Offset(
0.0,
0.0,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: digital_lcd_number
description: An automatic sizer digital single-digit number with LCD style widget.
version: 0.1.0
version: 0.1.1
# homepage:
repository: https://github.com/immadisairaj/digital_lcd_number

Expand Down

0 comments on commit ca6af77

Please sign in to comment.