Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main(){
  4. runApp(MyApp());
  5. }
  6.  
  7. class MyApp extends StatelessWidget{
  8. @override
  9. Widget build(BuildContext context) {
  10. return MaterialApp(
  11. title: "Test",
  12. home: Scaffold(
  13. appBar: AppBar(title: Text("Test")),
  14. body: Container(
  15. child: Center(
  16. child: RaisedButton(
  17. color: Colors.redAccent,
  18. textColor: Colors.white,
  19. onPressed: (){testAlert(context);},
  20. child: Text("PressMe"),
  21. ),
  22. ),
  23. ),
  24. ),
  25. );
  26. }
  27. void testAlert(BuildContext context){
  28. var alert = AlertDialog(
  29. title: Text("Test"),
  30. content: Text("Done..!"),
  31. );
  32.  
  33. showDialog(
  34. context: context,
  35. builder: (BuildContext context){
  36. return alert;
  37. }
  38. );
  39. }
  40. }
  41.  
  42. Performing hot reload...
  43. Syncing files to device ZUK Z2131...
  44. Reloaded 0 of 419 libraries in 1,929ms.
  45. I/flutter (18652): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
  46. I/flutter (18652): The following assertion was thrown while handling a gesture:
  47. I/flutter (18652): No MaterialLocalizations found.
  48. I/flutter (18652): MyApp widgets require MaterialLocalizations to be provided by a Localizations widget ancestor.
  49. I/flutter (18652): Localizations are used to generate many different messages, labels,and abbreviations which are used
  50. I/flutter (18652): by the material library.
  51. I/flutter (18652): To introduce a MaterialLocalizations, either use a MaterialApp at the root of your application to
  52. I/flutter (18652): include them automatically, or add a Localization widget with a MaterialLocalizations delegate.
  53. I/flutter (18652): The specific widget that could not find a MaterialLocalizations ancestor was:
  54. I/flutter (18652): MyApp
  55. I/flutter (18652): The ancestors of this widget were:
  56. I/flutter (18652): [root]
  57. I/flutter (18652):
  58. I/flutter (18652): When the exception was thrown, this was the stack:
  59. I/flutter (18652): #0 debugCheckHasMaterialLocalizations.<anonymous closure> (package:flutter/src/material/debug.dart:124:7)
  60. I/flutter (18652): #1 debugCheckHasMaterialLocalizations (package:flutter/src/material/debug.dart:127:4)
  61. I/flutter (18652): #2 showDialog (package:flutter/src/material/dialog.dart:635:10)
  62. I/flutter (18652): #3 MyApp.testAlert (package:flutter_app/main.dart:33:5)
  63. I/flutter (18652): #4 MyApp.build.<anonymous closure> (package:flutter_app/main.dart:19:29)
  64. I/flutter (18652): #5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
  65. I/flutter (18652): #6 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30)
  66. I/flutter (18652): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
  67. I/flutter (18652): #8 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
  68. I/flutter (18652): #9 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
  69. I/flutter (18652): #10 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
  70. I/flutter (18652): #11 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
  71. I/flutter (18652): #12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
  72. I/flutter (18652): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:180:19)
  73. I/flutter (18652): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
  74. I/flutter (18652): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
  75. I/flutter (18652): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
  76. I/flutter (18652): #17 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
  77. I/flutter (18652): #18 _invoke1 (dart:ui/hooks.dart:168:13)
  78. I/flutter (18652): #19 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
  79. I/flutter (18652):
  80. I/flutter (18652): Handler: onTap
  81. I/flutter (18652): Recognizer:
  82. I/flutter (18652): TapGestureRecognizer#d5d82(debugOwner: GestureDetector, state: possible, won arena, finalPosition:
  83. I/flutter (18652): Offset(220.2, 406.1), sent tap down)
  84. I/flutter (18652): ════════════════════════════════════════════════════════════════════════════════════════════════════
  85. W/ActivityThread(18652): handleWindowVisibility: no activity for token android.os.BinderProxy@59b4e8d
  86. I/ViewRootImpl(18652): CPU Rendering VSync enable = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement