【FLUTTER ANDROID STUDIO and IOS】wave slider

 import 'package:flutter/material.dart';

import 'package:wave_slider/wave_slider.dart';
void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: SliderDemo(),
);
}
}
class SliderDemo extends StatefulWidget {
@override
_SliderDemoState createState() => _SliderDemoState();
}

class _SliderDemoState extends State<SliderDemo> {
double _dragValue = 0;

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.brown[50],
appBar: AppBar(
title: Text("Flutter Wave Slider Demo"),
automaticallyImplyLeading: false,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
WaveSlider(
color: Colors.teal,
sliderHeight: 70,
displayTrackball: true,
onChanged: (double dragUpdate) {
setState(() {
_dragValue = dragUpdate * 150;
});
},
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Drag Value',
style: TextStyle(fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'$_dragValue',
style: TextStyle(fontSize: 16,
color: Colors.red,),
),
)
],
),
);
}
}

No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *