From 137c5ac8e21419a0e6161baff704946412cdc48c Mon Sep 17 00:00:00 2001 From: Nikhil Vadoliya Date: Sat, 28 Nov 2020 17:28:30 +0530 Subject: [PATCH] -Code refactoer --- example/lib/main.dart | 39 +++++++++++++++-------------------- example/test/widget_test.dart | 15 ++++++++++++++ lib/src/slider.dart | 1 - 3 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 example/test/widget_test.dart diff --git a/example/lib/main.dart b/example/lib/main.dart index 362a4c1..c1560fe 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_slider_drawer/flutter_slider_drawer.dart'; -import 'dart:async'; - import 'main_widget.dart'; import 'menu_widget.dart'; @@ -30,26 +28,23 @@ class _MyAppState extends State { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( - body: Padding( - padding: const EdgeInsets.only(top: 0), - child: SliderMenuContainer( - appBarColor: Colors.white, - key: _key, - sliderMenuOpenSize: 200, - title: Text( - title, - style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700), - ), - sliderMenu: MenuWidget( - onItemClick: (title) { - _key.currentState.closeDrawer(); - setState(() { - this.title = title; - }); - }, - ), - sliderMain: MainWidget()), - ), + body: SliderMenuContainer( + appBarColor: Colors.white, + key: _key, + sliderMenuOpenSize: 200, + title: Text( + title, + style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700), + ), + sliderMenu: MenuWidget( + onItemClick: (title) { + _key.currentState.closeDrawer(); + setState(() { + this.title = title; + }); + }, + ), + sliderMain: MainWidget()), ), ); } diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart new file mode 100644 index 0000000..dfe82ac --- /dev/null +++ b/example/test/widget_test.dart @@ -0,0 +1,15 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + + }); +} diff --git a/lib/src/slider.dart b/lib/src/slider.dart index 900e51f..394f1f8 100644 --- a/lib/src/slider.dart +++ b/lib/src/slider.dart @@ -133,7 +133,6 @@ class SliderMenuContainerState extends State animation.value, widget.sliderMenuOpenSize), child: child, ); - return child; }, child: Container( width: double.infinity,