Files
apidash/packages/genai/lib/widgets/ai_config_slider.dart
Ankit Mahato 72fea1ba65 Refactor genai package to new modular interface
Reorganized the genai package by removing legacy LLM-related files and introducing a new modular interface under the 'interface' directory. Added provider-specific model classes, centralized constants, and updated the example to use the new API and data structures. Updated exports in genai.dart and improved dependency management.
2025-08-27 02:08:36 +05:30

37 lines
919 B
Dart

import 'package:flutter/material.dart';
import '../models/models.dart';
class AIConfigSlider extends StatelessWidget {
final ModelConfig configuration;
final Function(ModelConfig) onSliderUpdated;
final bool readonly;
const AIConfigSlider({
super.key,
required this.configuration,
required this.onSliderUpdated,
this.readonly = false,
});
@override
Widget build(BuildContext context) {
final val = configuration.value.value as (double, double, double);
return Row(
children: [
Expanded(
child: Slider(
min: val.$1,
value: val.$2,
max: val.$3,
onChanged: (x) {
if (readonly) return;
configuration.value.value = (val.$1, x, val.$3);
onSliderUpdated(configuration);
},
),
),
Text(val.$2.toStringAsFixed(2)),
],
);
}
}