mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 01:35:25 +00:00
add device type comes from products
This commit is contained in:
@ -2,20 +2,34 @@ import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
class CounterWidget extends StatefulWidget {
|
||||
final int initialCount;
|
||||
final ValueChanged<int> onCountChanged;
|
||||
|
||||
const CounterWidget({
|
||||
Key? key,
|
||||
this.initialCount = 0,
|
||||
required this.onCountChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CounterWidgetState createState() => _CounterWidgetState();
|
||||
}
|
||||
|
||||
class _CounterWidgetState extends State<CounterWidget> {
|
||||
int _counter = 0;
|
||||
late int _counter = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_counter = widget.initialCount;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager
|
||||
.counterBackgroundColor, // Background color for the counter
|
||||
color: ColorsManager.counterBackgroundColor, // Background color for the counter
|
||||
borderRadius: BorderRadius.circular(20), // Rounded corners
|
||||
),
|
||||
child: Row(
|
||||
@ -28,10 +42,11 @@ class _CounterWidgetState extends State<CounterWidget> {
|
||||
setState(() {
|
||||
if (_counter > 0) {
|
||||
_counter--;
|
||||
widget.onCountChanged(_counter);
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.remove,
|
||||
color: ColorsManager.spaceColor, // Blue color
|
||||
size: 18, // Icon size
|
||||
@ -52,6 +67,7 @@ class _CounterWidgetState extends State<CounterWidget> {
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_counter++;
|
||||
widget.onCountChanged(_counter);
|
||||
});
|
||||
},
|
||||
child: const Icon(
|
||||
|
Reference in New Issue
Block a user