Added Smart Linkage Button

This commit is contained in:
Mohammad Salameh
2024-04-28 09:32:49 +03:00
parent b9c181c944
commit ca71574bf2
3 changed files with 40 additions and 16 deletions

View File

@ -6,6 +6,8 @@ import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/app_body.dart'; import 'package:syncrow_app/features/app_layout/view/widgets/app_body.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/default_app_bar.dart'; import 'package:syncrow_app/features/app_layout/view/widgets/default_app_bar.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/default_nav_bar.dart'; import 'package:syncrow_app/features/app_layout/view/widgets/default_nav_bar.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/smart_linkage_view.dart';
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class AppLayout extends StatelessWidget { class AppLayout extends StatelessWidget {
@ -32,7 +34,14 @@ class AppLayout extends StatelessWidget {
: null, : null,
body: const AppBody(), body: const AppBody(),
bottomNavigationBar: const DefaultNavBar(), bottomNavigationBar: const DefaultNavBar(),
), floatingActionButton: FloatingActionButton(
onPressed: () {
Navigator.of(context).push(CustomPageRoute(
builder: (context) => const SmartLinkgeView()));
},
backgroundColor: ColorsManager.primaryColor,
child: const Icon(Icons.refresh),
)),
), ),
); );
}, },

View File

@ -1,12 +1,14 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class SmartLinkgeView extends StatelessWidget { class SmartLinkgeView extends StatelessWidget {
const SmartLinkgeView({super.key}); const SmartLinkgeView({super.key});
@ -90,6 +92,16 @@ class SmartLinkgeView extends StatelessWidget {
], ],
), ),
), ),
const Spacer(),
DefaultContainer(
onTap: () {},
padding: const EdgeInsets.symmetric(horizontal: 50, vertical: 10),
color: ColorsManager.primaryColorWithOpacity,
child: const BodyMedium(
text: 'Custom linkage Type',
fontColor: Colors.white,
),
),
], ],
), ),
); );

View File

@ -15,15 +15,18 @@ class DefaultButton extends StatelessWidget {
this.customButtonStyle, this.customButtonStyle,
this.backgroundColor, this.backgroundColor,
this.foregroundColor, this.foregroundColor,
this.borderRadius,
this.height,
this.padding,
}); });
final void Function()? onPressed; final void Function()? onPressed;
final Widget child; final Widget child;
final double? height;
final bool isSecondary; final bool isSecondary;
final double? borderRadius;
final bool enabled; final bool enabled;
final double? padding;
final bool isDone; final bool isDone;
final bool isLoading; final bool isLoading;
@ -65,21 +68,21 @@ class DefaultButton extends StatelessWidget {
}), }),
shape: MaterialStateProperty.all( shape: MaterialStateProperty.all(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(borderRadius ?? 20),
), ),
), ),
fixedSize: MaterialStateProperty.all( fixedSize: MaterialStateProperty.all(
const Size.fromHeight(50), const Size.fromHeight(50),
), ),
padding: MaterialStateProperty.all( padding: MaterialStateProperty.all(
const EdgeInsets.all(10), EdgeInsets.all(padding ?? 10),
), ),
minimumSize: MaterialStateProperty.all( minimumSize: MaterialStateProperty.all(
const Size.fromHeight(50), const Size.fromHeight(50),
), ),
), ),
child: SizedBox( child: SizedBox(
height: 50, height: height ?? 50,
child: Center( child: Center(
child: isLoading child: isLoading
? const SizedBox.square( ? const SizedBox.square(