animated_weight_picker 1.0.3
animated_weight_picker: ^1.0.3 copied to clipboard
Animated Weight Picker allows to select a weight by swiping or dragging a handle along a scale.
import 'package:animated_weight_picker/animated_weight_picker.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final double min = 0;
final double max = 10;
String selectedValue = '';
@override
void initState() {
selectedValue = min.toString();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Animated Weight Picker'),
),
body: Center(
child: SizedBox(
width: 500,
child: AnimatedWeightPicker(
min: 0,
max: 10,
onChange: (newValue) {
setState(() {
selectedValue = newValue;
});
},
),
),
),
);
}
}