Skip to content

Instantly share code, notes, and snippets.

@rydmike
Created May 13, 2022 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rydmike/696c382392516e8cd66038f34847af94 to your computer and use it in GitHub Desktop.
Save rydmike/696c382392516e8cd66038f34847af94 to your computer and use it in GitHub Desktop.
Flutter 3.0 NOT removed buttons!
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
const Color lightCyan = Color(0xFF7DBBB2);
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
toggleableActiveColor: lightCyan,
),
debugShowCheckedModeBanner: false,
home: const Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatefulWidget {
const MyWidget({super.key});
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
bool switchOn = true;
@override
Widget build(BuildContext context) {
return Column(
children: [
Text(
'Hello, World!',
style: Theme.of(context).textTheme.headline4,
),
SwitchListTile(
title: const Text('ThemeData.toggleableActiveColor '
'is not yet deprecated'),
subtitle:
const Text('It was mentioned as deprecated in early release '
'info, but no longer mentioned.'),
value: switchOn,
onChanged: (bool value) {
setState(() {
switchOn = value;
});
},
),
// These buttons still exist too!
FlatButton(onPressed: () {}, child: const Text("I'm a FlatButton")),
const SizedBox(height: 8),
RaisedButton(onPressed: () {}, child: const Text("I'm a RaisedButton")),
//OutlineButton(onPressed: () {}, child: const Text('OutlineButton')),
const SizedBox(height: 8),
const Text('Based on Flutter 3 announcement the above buttons '
'should be removed in v3!?'),
const Text('The OutlineButton is removed though!'),
],
);
}
}
@rydmike
Copy link
Author

rydmike commented May 13, 2022

With the release of Flutter 3.0 the old buttons are supposed to be removed based on this:
https://docs.flutter.dev/release/breaking-changes/2-10-deprecations

Mentioned where it is mentioned that deprecated FlatButton, RaisedButton and OutlineButton are removed.
This PR is referenced flutter/flutter#98546, however it only removes the ``OutlineButton` the other buttons remain in Flutter 3.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment