浏览代码

migrate example from FlatButton to TextButton

lukepighetti 4 年之前
父节点
当前提交
15b960587c

+ 1 - 5
example/lib/components/demo/demo_simple_component.dart

@@ -50,11 +50,7 @@ class DemoSimpleComponent extends StatelessWidget {
             padding: EdgeInsets.only(top: 15.0),
             padding: EdgeInsets.only(top: 15.0),
             child: ConstrainedBox(
             child: ConstrainedBox(
               constraints: BoxConstraints(minHeight: 42.0),
               constraints: BoxConstraints(minHeight: 42.0),
-              child: FlatButton(
-                highlightColor:
-                    ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(17),
-                splashColor:
-                    ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(34),
+              child: TextButton(
                 onPressed: () {
                 onPressed: () {
                   if (result == null) {
                   if (result == null) {
                     /// You can use [Navigator.pop]
                     /// You can use [Navigator.pop]

+ 2 - 16
example/lib/components/home/home_component.dart

@@ -57,9 +57,7 @@ class HomeComponentState extends State<HomeComponent> {
           opacity: _deepLinkOpacity,
           opacity: _deepLinkOpacity,
           duration: Duration(milliseconds: 250),
           duration: Duration(milliseconds: 250),
           child: Center(
           child: Center(
-            child: FlatButton(
-              highlightColor: const Color(0x11FFFFFF),
-              splashColor: const Color(0x22FFFFFF),
+            child: TextButton(
               onPressed: () {
               onPressed: () {
                 if (_deepLinkOpacity == 1.0) {
                 if (_deepLinkOpacity == 1.0) {
                   Timer(Duration(milliseconds: 2000), () {
                   Timer(Duration(milliseconds: 2000), () {
@@ -139,15 +137,6 @@ class HomeComponentState extends State<HomeComponent> {
                 ),
                 ),
               ),
               ),
             ),
             ),
-//            Padding(
-//              padding: EdgeInsets.only(top: 35.0, bottom: 25),
-//              child: Center(
-//                child: ConstrainedBox(
-//                  constraints: BoxConstraints.tightFor(height: 60.0),
-//                  child: deepLinkWidget(context),
-//                ),
-//              ),
-//            ),
           ],
           ],
         ),
         ),
       ),
       ),
@@ -161,10 +150,7 @@ class HomeComponentState extends State<HomeComponent> {
       padding: EdgeInsets.all(4.0),
       padding: EdgeInsets.all(4.0),
       child: Container(
       child: Container(
         height: 42.0,
         height: 42.0,
-        child: FlatButton(
-          color: const Color(0x22FFFFFF),
-          highlightColor: const Color(0x11FFFFFF),
-          splashColor: const Color(0x22FFFFFF),
+        child: TextButton(
           child: Column(
           child: Column(
             mainAxisSize: MainAxisSize.min,
             mainAxisSize: MainAxisSize.min,
             mainAxisAlignment: MainAxisAlignment.center,
             mainAxisAlignment: MainAxisAlignment.center,

+ 1 - 1
example/lib/config/route_handlers.dart

@@ -50,7 +50,7 @@ var demoFunctionHandler = Handler(
             actions: <Widget>[
             actions: <Widget>[
               Padding(
               Padding(
                 padding: EdgeInsets.only(bottom: 8.0, right: 8.0),
                 padding: EdgeInsets.only(bottom: 8.0, right: 8.0),
-                child: FlatButton(
+                child: TextButton(
                   onPressed: () {
                   onPressed: () {
                     Navigator.of(context).pop(true);
                     Navigator.of(context).pop(true);
                   },
                   },