Advertisement
sourav8256

App Bar Flutter

Sep 10th, 2023 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. ============== pubspecs.yaml file ==================
  2.  
  3. flutter_svg: 1.0.3
  4.  
  5. import 'package:flutter_svg/flutter_svg.dart';
  6.  
  7. ============== How to Use it =========================
  8.  
  9. SizedBox(
  10. height: 30,
  11. ),
  12. appBar1(title: "Payment for services", context: context),
  13. SizedBox(
  14. height: 10,
  15. ),
  16.  
  17. ================ App Bar Code (place it openly in any dart file) ===================
  18.  
  19. import 'package:flutter/material.dart';
  20. import 'package:legalapp/colors.dart';
  21. import 'package:legalapp/components/AppDrawer.dart';
  22. import 'package:flutter_svg/flutter_svg.dart';
  23.  
  24.  
  25. Container appBar1({required context, title,theme}) {
  26. return Container(
  27. color: AppColors.primaryColor,
  28. padding: EdgeInsets.only(top: 5.0,bottom: 5.0),
  29. width: MediaQuery.of(context).size.width,
  30. child: Row(
  31. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  32. children: [
  33. InkWell(
  34. onTap: () {
  35. AppDrawer.of(context)!.toggle();
  36. },
  37. child: Icon(
  38. Icons.menu,
  39. size: 40,
  40. color: theme??AppColors.primaryTextColor,
  41.  
  42. ),
  43. ),
  44. Text(
  45. title ?? "Categories",
  46. style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold,color: AppColors.primaryTextColor),
  47. ),
  48. InkWell(
  49. onTap: () {
  50. // context.open();
  51. AppDrawer.of(context)!.toggle();
  52. },
  53. child: SvgPicture.asset(
  54. 'assets/icons/Menu.svg',
  55. height: 8,
  56. width: 18,
  57.  
  58. color: theme??Colors.black,
  59. semanticsLabel: 'A red up arrow',
  60. ),
  61. ),
  62. ],
  63. ),
  64. );
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement