Skip to content

Commit

Permalink
reupload files
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhart1010 committed Jun 22, 2022
0 parents commit b309242
Show file tree
Hide file tree
Showing 61 changed files with 3,101 additions and 0 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## 0.2.1

- Updated readme.
- Updated analysis options.

## 0.2.0

- Allow `RadialGauge` to pass the child as a label.
- Added `child` parameter to the `RadialGauge` widget.
- Removed `style` and `labelProvider` arguments.
- Migrated `GaugeLabelProvider` class.
- Added `child` and `builder` parameters to the `AnimatedRadialGauge` widget.
- Introduced `RadialGaugeLabel` widget.
- The `AnimatedRadialGauge` value is now constrained by the `min` and `max` parameters.
- Added `GaugeLabelProvider.map` constructor.
- Added `AnimatedLinearGauge` and `LinearGauge`.
- Updated `readme` with new features.
- Added `LinearGauge` example page.
- Removed obsolete dependencies.
- Redone structure of example project.
- Added 80 char limit to code.

## 0.1.0

- Migrated to the render box.
- Added `flutter_lints` package for the analysis.
- Removed gauge custom painter.
- Renamed `Gauge` into `AnimatedRadialGauge`.
- `AnimatedRadialGauge` is simplicity animated widget.
- Added `initialValue` which describes the value from which the gauge indicator will be initially animated to the current `value`.
- Added `RadialGauge` widget, that supports drawing gauge indicator without the animations.

## 0.0.1

- Initial release.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
147 changes: 147 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Gauge indicator

Animated, highly customizable, open-source Flutter gauge indicator widgets. They use renderbox under the hood, thus ensuring high performance.

### Working web example of package [here](https://gauge-indicator.klyta.it/)

![AnimatedRadialgauge](readme/animated.gif)

## Usage

It is as simple as defining a `RadialGauge` or an `AnimatedRadialGauge` widget in your widget tree.

## Code

```dart
/// Build method of your widget.
@override
Widget build(BuildContext context) {
// Create animated radial gauge.
// All arguments changes will be automatically animated.
return AnimatedRadialGauge(
/// The animation duration.
duration: const Duration(milliseconds: 500),
/// Gauge value.
value: gaugeValue,
/// Provide the [min] and [max] value for the [value] argument.
min: 0,
max: 100,
/// Optionally, you can configure your gauge, providing additional
/// styles and transformers.
axis: GaugeAxis(
/// Render the gauge as a 260-degree arc.
degrees: 260,
/// Display the green value progress.
transformer: const GaugeAxisTransformer.progress(color: Colors.red),
/// Set the background color and axis thickness.
style: const GaugeAxisStyle(
thickness: 20,
background: Color(0xFFD9DEEB),
),
/// Define the pointer that will indicate the progress.
pointer: RoundedTrianglePointer(
size: 20,
backgroundColor: Colors.black,
borderRadius: 2,
border: const GaugePointerBorder(
color: Colors.white,
width: 2,
),
),
),
/// You can also, define the child builder.
/// This way you will build a value label, but you can use the widget of your choice.
///
/// For non-value related widgets, take a look at the [child] parameter.
builder: (context, child, value) => RadialGaugeLabel(
value: value,
style: const TextStyle(
color: Colors.black,
fontSize: 46,
fontWeight: FontWeight.bold,
),
),
);
}
```

## Output

![example](readme/example.png)

# Linear Gauge

![example](readme/animated_linear_gauge_readme1.gif)

## Usage

It is as simple as defining a `LinearGauge` or an `AnimatedLinearGauge` widget in your widget tree.

## Code

```dart
@override
Widget build(BuildContext context) {
// All property changes are animated
return AnimatedLinearGauge(
// Value of the gauge, for special cases we allow doubles
value: 5,
// Maximum value constrained to integer
// for special edge case evasion
max: 15,
// color of the full width background rect
backgroundColor:
const Color.fromARGB(255, 132, 132, 132),
// how much space do you want on the vertical axis of segments,
// does not affect thumb height
verticalSegmentMargin: 2.0,
// how rounded are supposed to be the corners
cornerRadius: 8.0,
// width of separators dividing bar into individual segments
separatorThickness: 2.0,
// you can prevent widget from displaying dividers
// when there is a lot of very thin segments,
// if segment is thinner than this value, no separators will
// be rendered
minimumSegmentThickness: 8.0,
// you can define many color ranges on the axis,
// if you do not pass any semgent here
// it will put one by default
segments: const [
LinearGaugeSegment(
// you do not define ending value of the segment directly,
// it will continue till next segment or to max value
start: 0,
color: Colors.red,
),
LinearGaugeSegment(
start: 5,
color: Colors.green,
),
LinearGaugeSegment(
start: 10,
color: Colors.blue,
),
],
// duration of the animation
duration: const Duration(milliseconds: 400),
// curve implementation that you want to use
curve: Curves.ease,
// callback triggered when the animation ends
onEnd: () {},
// you can override default thumb style
thumbStyle: const ThumbStyle(
// infill color
color: Colors.white,
// width of the outer cutout mask
strokeWidth: 2.0,
// width of the infill
thickness: 6.0,
),
);
}
```

## Output

![example](readme/animated_linear_gauge_readme0.gif)
8 changes: 8 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
- lines_longer_than_80_chars
analyzer:
errors:
lines_longer_than_80_chars: warning
Binary file added example/.DS_Store
Binary file not shown.
16 changes: 16 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# example

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
8 changes: 8 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
- lines_longer_than_80_chars
analyzer:
errors:
lines_longer_than_80_chars: warning
43 changes: 43 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:example/pages/linear_gauge_example_page/linear_gauge_example_page.dart';
import 'package:example/pages/linear_gauge_example_page/radial_gauge_example_page.dart';
import 'package:flutter/material.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
tabBarTheme: const TabBarTheme(
labelColor: Colors.black,
),
),
home: const DefaultTabController(
length: 2,
child: Scaffold(
appBar: TabBar(tabs: [
Tab(
text: 'Radial gauge',
),
Tab(
text: 'Linear gauge',
),
]),
body: TabBarView(
children: [
RadialGaugeExamplePage(),
LinearGaugeExamplePage(),
],
),
),
),
);
}
}
Loading

0 comments on commit b309242

Please sign in to comment.