"CupertinoSegmentedControl flutter example" Code Answer's
You're definitely familiar with the best coding language Dart that developers use to develop their projects and they get all their queries like "CupertinoSegmentedControl flutter example" answered properly. Developers are finding an appropriate answer about CupertinoSegmentedControl flutter example related to the Dart coding language. By visiting this online portal developers get answers concerning Dart codes question like CupertinoSegmentedControl flutter example. Enter your desired code related query in the search bar and get every piece of information about Dart code related question on CupertinoSegmentedControl flutter example.
CupertinoSegmentedControl flutter example
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CupertinoApp(
// Remove the debug banner
debugShowCheckedModeBanner: false,
title: 'Kindacode.com',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String _selectedValue;
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
child: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CupertinoSegmentedControl(
children: {
'a': Container(
color: _selectedValue == 'a' ? Colors.blue[100] : Colors.white,
padding: EdgeInsets.all(8),
child: Text('A'),
),
'b': Container(
color: _selectedValue == 'b' ? Colors.blue[100] : Colors.white,
padding: EdgeInsets.all(8),
child: Text('B'),
),
'c': Container(
color: _selectedValue == 'c' ? Colors.blue[100] : Colors.white,
padding: EdgeInsets.all(8),
child: Text('C'),
),
'd': Container(
color: _selectedValue == 'd' ? Colors.blue[100] : Colors.white,
padding: EdgeInsets.all(8),
child: Text('D'),
),
},
onValueChanged: (value) {
setState(() {
_selectedValue = value;
});
},
),
SizedBox(height: 30),
_selectedValue != null
? Text(
_selectedValue,
style: TextStyle(fontSize: 50),
)
: Container()
],
),
),
),
);
}
}
Source: www.kindacode.com
All those coders who are working on the Dart based application and are stuck on CupertinoSegmentedControl flutter example can get a collection of related answers to their query. Programmers need to enter their query on CupertinoSegmentedControl flutter example related to Dart code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about CupertinoSegmentedControl flutter example for the programmers working on Dart code while coding their module. Coders are also allowed to rectify already present answers of CupertinoSegmentedControl flutter example while working on the Dart language code. Developers can add up suggestions if they deem fit any other answer relating to "CupertinoSegmentedControl flutter example". Visit this developer's friendly online web community, CodeProZone, and get your queries like CupertinoSegmentedControl flutter example resolved professionally and stay updated to the latest Dart updates.