Created
August 10, 2020 05:15
-
-
Save rashmisridar/c6b866c8042eaadf018939f2e6f7b932 to your computer and use it in GitHub Desktop.
NeumorphicButton UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:ui'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:flutter_neumorphic/flutter_neumorphic.dart'; | |
import 'package:flutterappnuephamorphic/custom_box_shadow.dart'; | |
import 'package:flutterappnuephamorphic/sizeconfig.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:flutter_xlider/flutter_xlider.dart'; | |
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | |
void main()=>runApp(MaterialApp(home: MyApp(),)); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
SystemChrome.setEnabledSystemUIOverlays([]); | |
SystemChrome.setPreferredOrientations([ | |
DeviceOrientation.portraitUp, | |
DeviceOrientation.portraitDown, | |
]); | |
return LayoutBuilder(builder: (context, constraints) { | |
return OrientationBuilder(builder: (context, orientation) { | |
Responsive().init(constraints, orientation); | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
title: 'Music Player', | |
home: TeslaSample(), | |
); | |
}); | |
}); | |
} | |
} | |
class TeslaSample extends StatefulWidget { | |
@override | |
createState() => _TeslaSampleState(); | |
} | |
class _TeslaSampleState extends State<TeslaSample> { | |
@override | |
Widget build(BuildContext context) { | |
return NeumorphicTheme( | |
theme: NeumorphicThemeData( | |
baseColor: Color(0xFF30353B), | |
intensity: 0.1, | |
accentColor: Color(0xFF0F95E6), | |
lightSource: LightSource.topLeft, | |
depth: 2, | |
), | |
child: Scaffold( | |
backgroundColor: Color(0xFF30353B), | |
body: SafeArea( | |
child: NeumorphicBackground(child: _PageContent()), | |
), | |
), | |
); | |
} | |
} | |
class _PageContent extends StatefulWidget { | |
@override | |
__PageContentState createState() => __PageContentState(); | |
} | |
class __PageContentState extends State<_PageContent> { | |
double firstOffset = 5.0; | |
double secondOffset = -5.0; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
margin: EdgeInsets.only(top: 30), | |
height: double.infinity, | |
width: double.infinity, | |
//color: Color(0xFF2D3238), | |
color: Color(0xFF110d0d), | |
child: _buildTopBar(context), | |
); | |
} | |
Widget _buildTopBar(BuildContext context) { | |
return Align( | |
alignment: Alignment.center, | |
child: Padding( | |
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 24), | |
child: Center( | |
child: _bumpButton( | |
Icon(Icons.add,color: Colors.white,) | |
), | |
), | |
), | |
); | |
} | |
Widget _bumpButton(Widget child) { | |
return | |
NeumorphicButton( | |
provideHapticFeedback: true, | |
curve: Neumorphic.DEFAULT_CURVE, | |
onPressed: () {}, | |
// margin: EdgeInsets.all(10), | |
// padding: EdgeInsets.all(14.0), | |
style: NeumorphicStyle( | |
border:NeumorphicBorder(isEnabled: true,width: -4, | |
color: Colors.grey.withAlpha(5)), | |
shadowLightColor: Color(0xFF2D3238),//Colors.grey, | |
shadowDarkColor:Colors.black , | |
boxShape: NeumorphicBoxShape.circle(),//circle(), | |
// color: Color(0xFF373C42) | |
color: Color(0xFF110d0d), | |
depth: 5,//19,//8, | |
intensity: 0.6,//0.25, | |
surfaceIntensity:0.2,//0.25,*/ | |
shape: NeumorphicShape.convex, | |
), | |
child: child); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment