From 466d2f5d0d4327815af1dc596c997eeea10deb8a Mon Sep 17 00:00:00 2001 From: Akshath Jain Date: Mon, 26 Apr 2021 23:02:38 -0400 Subject: [PATCH] formatting changes, v2.0.0+1 --- CHANGELOG.md | 7 + README.md | 2 +- example/lib/main.dart | 288 +++++++++++++++----------------- lib/sliding_up_panel.dart | 2 +- pubspec.yaml | 4 +- test/sliding_up_panel_test.dart | 3 +- 6 files changed, 151 insertions(+), 155 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4871675..8d40074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.0.0+1] - [April 26, 2021] +### Features +- Formatted code according to dartfmt + +### Documentation +- Updated documentation to reflect new features and fixes + ## [2.0.0] - [April 26, 2021] ### Features - Addressed issue #223,#240 - Added null safety support diff --git a/README.md b/README.md index fdccbb1..330f920 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A draggable Flutter widget that makes implementing a SlidingUpPanel much easier! Add the following to your `pubspec.yaml` file: ```yaml dependencies: - sliding_up_panel: ^2.0.0 + sliding_up_panel: ^2.0.0+1 ``` Note that `v1.0.0` introduced some breaking changes outlined [below](#breaking-changes). diff --git a/example/lib/main.dart b/example/lib/main.dart index 600d428..243cfd8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -21,7 +21,6 @@ void main() => runApp(SlidingUpPanelExample()); class SlidingUpPanelExample extends StatelessWidget { @override Widget build(BuildContext context) { - SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( systemNavigationBarColor: Colors.grey[200], systemNavigationBarIconBrightness: Brightness.dark, @@ -45,28 +44,26 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - final double _initFabHeight = 120.0; double _fabHeight = 0; double _panelHeightOpen = 0; double _panelHeightClosed = 95.0; @override - void initState(){ + void initState() { super.initState(); _fabHeight = _initFabHeight; } @override - Widget build(BuildContext context){ + Widget build(BuildContext context) { _panelHeightOpen = MediaQuery.of(context).size.height * .80; return Material( child: Stack( alignment: Alignment.topCenter, children: [ - SlidingUpPanel( maxHeight: _panelHeightOpen, minHeight: _panelHeightClosed, @@ -74,9 +71,12 @@ class _HomePageState extends State { parallaxOffset: .5, body: _body(), panelBuilder: (sc) => _panel(sc), - borderRadius: BorderRadius.only(topLeft: Radius.circular(18.0), topRight: Radius.circular(18.0)), - onPanelSlide: (double pos) => setState((){ - _fabHeight = pos * (_panelHeightOpen - _panelHeightClosed) + _initFabHeight; + borderRadius: BorderRadius.only( + topLeft: Radius.circular(18.0), + topRight: Radius.circular(18.0)), + onPanelSlide: (double pos) => setState(() { + _fabHeight = pos * (_panelHeightOpen - _panelHeightClosed) + + _initFabHeight; }), ), @@ -89,24 +89,21 @@ class _HomePageState extends State { Icons.gps_fixed, color: Theme.of(context).primaryColor, ), - onPressed: (){}, + onPressed: () {}, backgroundColor: Colors.white, ), ), Positioned( - top: 0, - child: ClipRRect( - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).padding.top, - color: Colors.transparent, - ) - ) - ) - ), + top: 0, + child: ClipRRect( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).padding.top, + color: Colors.transparent, + )))), //the SlidingUpPanel Title Positioned( @@ -115,140 +112,140 @@ class _HomePageState extends State { padding: const EdgeInsets.fromLTRB(24.0, 18.0, 24.0, 18.0), child: Text( "SlidingUpPanel Example", - style: TextStyle( - fontWeight: FontWeight.w500 - ), + style: TextStyle(fontWeight: FontWeight.w500), ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(24.0), - boxShadow: [BoxShadow( - color: Color.fromRGBO(0, 0, 0, .25), - blurRadius: 16.0 - )], + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, .25), blurRadius: 16.0) + ], ), ), ), - - ], ), ); } - Widget _panel(ScrollController sc){ + Widget _panel(ScrollController sc) { return MediaQuery.removePadding( - context: context, - removeTop: true, - child: ListView( - controller: sc, - children: [ - SizedBox(height: 12.0,), - - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 30, - height: 5, - decoration: BoxDecoration( - color: Colors.grey[300], - borderRadius: BorderRadius.all(Radius.circular(12.0)) + context: context, + removeTop: true, + child: ListView( + controller: sc, + children: [ + SizedBox( + height: 12.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 30, + height: 5, + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.all(Radius.circular(12.0))), ), - ), - ], - ), - - SizedBox(height: 18.0,), - - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Explore Pittsburgh", - style: TextStyle( - fontWeight: FontWeight.normal, - fontSize: 24.0, + ], + ), + SizedBox( + height: 18.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Explore Pittsburgh", + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 24.0, + ), ), - ), - ], - ), - - SizedBox(height: 36.0,), - - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - _button("Popular", Icons.favorite, Colors.blue), - _button("Food", Icons.restaurant, Colors.red), - _button("Events", Icons.event, Colors.amber), - _button("More", Icons.more_horiz, Colors.green), - ], - ), - - SizedBox(height: 36.0,), - - Container( - padding: const EdgeInsets.only(left: 24.0, right: 24.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ], + ), + SizedBox( + height: 36.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - - Text("Images", style: TextStyle(fontWeight: FontWeight.w600,)), - - SizedBox(height: 12.0,), - - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - + _button("Popular", Icons.favorite, Colors.blue), + _button("Food", Icons.restaurant, Colors.red), + _button("Events", Icons.event, Colors.amber), + _button("More", Icons.more_horiz, Colors.green), + ], + ), + SizedBox( + height: 36.0, + ), + Container( + padding: const EdgeInsets.only(left: 24.0, right: 24.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("Images", + style: TextStyle( + fontWeight: FontWeight.w600, + )), + SizedBox( + height: 12.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ CachedNetworkImage( - imageUrl: "https://images.fineartamerica.com/images-medium-large-5/new-pittsburgh-emmanuel-panagiotakis.jpg", + imageUrl: + "https://images.fineartamerica.com/images-medium-large-5/new-pittsburgh-emmanuel-panagiotakis.jpg", height: 120.0, width: (MediaQuery.of(context).size.width - 48) / 2 - 2, fit: BoxFit.cover, ), - CachedNetworkImage( - imageUrl: "https://cdn.pixabay.com/photo/2016/08/11/23/48/pnc-park-1587285_1280.jpg", + imageUrl: + "https://cdn.pixabay.com/photo/2016/08/11/23/48/pnc-park-1587285_1280.jpg", width: (MediaQuery.of(context).size.width - 48) / 2 - 2, height: 120.0, fit: BoxFit.cover, ), - - ], - ), - ], + ], + ), + ], + ), ), - ), - - SizedBox(height: 36.0,), - - Container( - padding: const EdgeInsets.only(left: 24.0, right: 24.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("About", style: TextStyle(fontWeight: FontWeight.w600,)), - - SizedBox(height: 12.0,), - - Text( - """Pittsburgh is a city in the state of Pennsylvania in the United States, and is the county seat of Allegheny County. A population of about 302,407 (2018) residents live within the city limits, making it the 66th-largest city in the U.S. The metropolitan population of 2,324,743 is the largest in both the Ohio Valley and Appalachia, the second-largest in Pennsylvania (behind Philadelphia), and the 27th-largest in the U.S.\n\nPittsburgh is located in the southwest of the state, at the confluence of the Allegheny, Monongahela, and Ohio rivers. Pittsburgh is known both as "the Steel City" for its more than 300 steel-related businesses and as the "City of Bridges" for its 446 bridges. The city features 30 skyscrapers, two inclined railways, a pre-revolutionary fortification and the Point State Park at the confluence of the rivers. The city developed as a vital link of the Atlantic coast and Midwest, as the mineral-rich Allegheny Mountains made the area coveted by the French and British empires, Virginians, Whiskey Rebels, and Civil War raiders.\n\nAside from steel, Pittsburgh has led in manufacturing of aluminum, glass, shipbuilding, petroleum, foods, sports, transportation, computing, autos, and electronics. For part of the 20th century, Pittsburgh was behind only New York City and Chicago in corporate headquarters employment; it had the most U.S. stockholders per capita. Deindustrialization in the 1970s and 80s laid off area blue-collar workers as steel and other heavy industries declined, and thousands of downtown white-collar workers also lost jobs when several Pittsburgh-based companies moved out. The population dropped from a peak of 675,000 in 1950 to 370,000 in 1990. However, this rich industrial history left the area with renowned museums, medical centers, parks, research centers, and a diverse cultural district.\n\nAfter the deindustrialization of the mid-20th century, Pittsburgh has transformed into a hub for the health care, education, and technology industries. Pittsburgh is a leader in the health care sector as the home to large medical providers such as University of Pittsburgh Medical Center (UPMC). The area is home to 68 colleges and universities, including research and development leaders Carnegie Mellon University and the University of Pittsburgh. Google, Apple Inc., Bosch, Facebook, Uber, Nokia, Autodesk, Amazon, Microsoft and IBM are among 1,600 technology firms generating \$20.7 billion in annual Pittsburgh payrolls. The area has served as the long-time federal agency headquarters for cyber defense, software engineering, robotics, energy research and the nuclear navy. The nation's eighth-largest bank, eight Fortune 500 companies, and six of the top 300 U.S. law firms make their global headquarters in the area, while RAND Corporation (RAND), BNY Mellon, Nova, FedEx, Bayer, and the National Institute for Occupational Safety and Health (NIOSH) have regional bases that helped Pittsburgh become the sixth-best area for U.S. job growth. + SizedBox( + height: 36.0, + ), + Container( + padding: const EdgeInsets.only(left: 24.0, right: 24.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("About", + style: TextStyle( + fontWeight: FontWeight.w600, + )), + SizedBox( + height: 12.0, + ), + Text( + """Pittsburgh is a city in the state of Pennsylvania in the United States, and is the county seat of Allegheny County. A population of about 302,407 (2018) residents live within the city limits, making it the 66th-largest city in the U.S. The metropolitan population of 2,324,743 is the largest in both the Ohio Valley and Appalachia, the second-largest in Pennsylvania (behind Philadelphia), and the 27th-largest in the U.S.\n\nPittsburgh is located in the southwest of the state, at the confluence of the Allegheny, Monongahela, and Ohio rivers. Pittsburgh is known both as "the Steel City" for its more than 300 steel-related businesses and as the "City of Bridges" for its 446 bridges. The city features 30 skyscrapers, two inclined railways, a pre-revolutionary fortification and the Point State Park at the confluence of the rivers. The city developed as a vital link of the Atlantic coast and Midwest, as the mineral-rich Allegheny Mountains made the area coveted by the French and British empires, Virginians, Whiskey Rebels, and Civil War raiders.\n\nAside from steel, Pittsburgh has led in manufacturing of aluminum, glass, shipbuilding, petroleum, foods, sports, transportation, computing, autos, and electronics. For part of the 20th century, Pittsburgh was behind only New York City and Chicago in corporate headquarters employment; it had the most U.S. stockholders per capita. Deindustrialization in the 1970s and 80s laid off area blue-collar workers as steel and other heavy industries declined, and thousands of downtown white-collar workers also lost jobs when several Pittsburgh-based companies moved out. The population dropped from a peak of 675,000 in 1950 to 370,000 in 1990. However, this rich industrial history left the area with renowned museums, medical centers, parks, research centers, and a diverse cultural district.\n\nAfter the deindustrialization of the mid-20th century, Pittsburgh has transformed into a hub for the health care, education, and technology industries. Pittsburgh is a leader in the health care sector as the home to large medical providers such as University of Pittsburgh Medical Center (UPMC). The area is home to 68 colleges and universities, including research and development leaders Carnegie Mellon University and the University of Pittsburgh. Google, Apple Inc., Bosch, Facebook, Uber, Nokia, Autodesk, Amazon, Microsoft and IBM are among 1,600 technology firms generating \$20.7 billion in annual Pittsburgh payrolls. The area has served as the long-time federal agency headquarters for cyber defense, software engineering, robotics, energy research and the nuclear navy. The nation's eighth-largest bank, eight Fortune 500 companies, and six of the top 300 U.S. law firms make their global headquarters in the area, while RAND Corporation (RAND), BNY Mellon, Nova, FedEx, Bayer, and the National Institute for Occupational Safety and Health (NIOSH) have regional bases that helped Pittsburgh become the sixth-best area for U.S. job growth. """, - softWrap: true, - ), - ], + softWrap: true, + ), + ], + ), ), - ), - - SizedBox(height: 24,), - ], - ) - ); + SizedBox( + height: 24, + ), + ], + )); } - Widget _button(String label, IconData icon, Color color){ + Widget _button(String label, IconData icon, Color color) { return Column( children: [ Container( @@ -257,25 +254,23 @@ class _HomePageState extends State { icon, color: Colors.white, ), - decoration: BoxDecoration( - color: color, - shape: BoxShape.circle, - boxShadow: [BoxShadow( + decoration: + BoxDecoration(color: color, shape: BoxShape.circle, boxShadow: [ + BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.15), blurRadius: 8.0, - )] - ), + ) + ]), + ), + SizedBox( + height: 12.0, ), - - SizedBox(height: 12.0,), - Text(label), ], - ); } - Widget _body(){ + Widget _body() { return FlutterMap( options: MapOptions( center: LatLng(40.441589, -80.010948), @@ -284,22 +279,17 @@ class _HomePageState extends State { ), layers: [ TileLayerOptions( - urlTemplate: "https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png" - ), - - MarkerLayerOptions( - markers: [ - Marker( + urlTemplate: "https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png"), + MarkerLayerOptions(markers: [ + Marker( point: LatLng(40.441753, -80.011476), builder: (ctx) => Icon( - Icons.location_on, - color: Colors.blue, - size: 48.0, - ), - height: 60 - ), - ] - ), + Icons.location_on, + color: Colors.blue, + size: 48.0, + ), + height: 60), + ]), ], ); } diff --git a/lib/sliding_up_panel.dart b/lib/sliding_up_panel.dart index 4d901b2..9a21204 100644 --- a/lib/sliding_up_panel.dart +++ b/lib/sliding_up_panel.dart @@ -8,4 +8,4 @@ Licensing: More information can be found here: https://github.com/akshathjain/sl library sliding_up_panel; -export 'src/panel.dart'; \ No newline at end of file +export 'src/panel.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index cd4e1a2..cb2838a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ name: sliding_up_panel description: A draggable Flutter widget that makes implementing a SlidingUpPanel much easier! -version: 2.0.0 +version: 2.0.0+1 homepage: https://github.com/akshathjain/sliding_up_panel environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: diff --git a/test/sliding_up_panel_test.dart b/test/sliding_up_panel_test.dart index 6f0feea..3828294 100644 --- a/test/sliding_up_panel_test.dart +++ b/test/sliding_up_panel_test.dart @@ -6,5 +6,4 @@ Copyright: © 2019, Akshath Jain. All rights reserved. Licensing: More information can be found here: https://github.com/akshathjain/sliding_up_panel/blob/master/LICENSE */ -void main() { -} +void main() {}