lang.dart 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:flutter/material.dart';
  2. class Lang extends StatefulWidget {
  3. const Lang({
  4. Key? key,
  5. }) : super(key: key);
  6. @override
  7. State<Lang> createState() => _LangState();
  8. }
  9. class _LangState extends State<Lang> {
  10. bool _hasBeenPressed = false;
  11. @override
  12. Widget build(BuildContext context) {
  13. return Padding(
  14. padding: const EdgeInsets.all(8.0),
  15. child: Row(
  16. children: [
  17. ElevatedButton(
  18. onPressed: () => {
  19. setState(() {
  20. _hasBeenPressed = !_hasBeenPressed;
  21. })
  22. },
  23. style: ElevatedButton.styleFrom(
  24. backgroundColor: _hasBeenPressed
  25. ? Colors.white.withOpacity(0.4)
  26. : Color(0xffFF6600),
  27. shape: RoundedRectangleBorder(
  28. borderRadius: BorderRadius.only(
  29. topLeft: Radius.circular(30),
  30. bottomLeft: Radius.circular(30)))),
  31. child: Text(
  32. 'EN',
  33. style: TextStyle(color: Colors.white),
  34. )),
  35. ElevatedButton(
  36. onPressed: () => {
  37. setState(() {
  38. _hasBeenPressed = !_hasBeenPressed;
  39. })
  40. },
  41. style: ElevatedButton.styleFrom(
  42. backgroundColor: _hasBeenPressed
  43. ? Color(0xffFF6600)
  44. : Colors.white.withOpacity(0.4),
  45. shape: RoundedRectangleBorder(
  46. borderRadius: BorderRadius.only(
  47. topRight: Radius.circular(30),
  48. bottomRight: Radius.circular(30)))),
  49. child: Text(
  50. 'ID',
  51. style: TextStyle(color: Colors.white),
  52. )),
  53. ],
  54. ),
  55. );
  56. }
  57. }