import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: Colors.lightGreen,
title: Text("Convert Text To Upper Case Lower Case"),
),
body: SafeArea(
child : Container(
alignment: Alignment.center,
child:MyHomePage(),
)
)
),
);
}
}
class MyHomePage extends StatefulWidget {
@override
MyHomePageState createState() => MyHomePageState();
}
class MyHomePageState extends State {
String output = 'BajarangiSoft.com';
void convertToLowerCase(){
setState(() {
output = output.toLowerCase() ;
});
}
void convertToUpperCase(){
setState(() {
output = output.toUpperCase() ;
});
}
Widget build(BuildContext context) {
return Column(
children: <Widget>[
SizedBox(height: 30.0,),
Container(
child: Text('$output',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20
)
)
),
RaisedButton(
child: Text('Upper Case'),
onPressed: convertToUpperCase,
color: Colors.lightGreen,
textColor: Colors.white,
),
RaisedButton(
child: Text('Lower Case'),
onPressed: convertToLowerCase,
color: Colors.redAccent,
textColor: Colors.white,
),
],
);
}
}