Skip to content

Commit

Permalink
✨ Add layout with scan button on the bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinmagrez committed Nov 6, 2020
1 parent e9bb3c9 commit 8ff9633
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 13 deletions.
18 changes: 18 additions & 0 deletions Smartway.UiComponent.Sample/Layouts/LayoutsSample.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:layouts="clr-namespace:Smartway.UiComponent.Layouts;assembly=Smartway.UiComponent"
mc:Ignorable="d"
x:Class="Smartway.UiComponent.Sample.Layouts.LayoutsSample">
<ContentPage.Content>
<layouts:ScannableLayout>
<layouts:ScannableLayout.LayoutContent>
<Label Text="Example layout avec bouton scan sur la page"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</layouts:ScannableLayout.LayoutContent>
</layouts:ScannableLayout>
</ContentPage.Content>
</ContentPage>
20 changes: 20 additions & 0 deletions Smartway.UiComponent.Sample/Layouts/LayoutsSample.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Smartway.UiComponent.Sample.Layouts
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LayoutsSample : ContentPage
{
public LayoutsSample()
{
InitializeComponent();
}
}
}
27 changes: 15 additions & 12 deletions Smartway.UiComponent.Sample/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
x:Class="Smartway.UiComponent.Sample.MainPage"
x:DataType="sample:MainPageViewModel"
x:Name="Self">
<StackLayout>
<Button x:Name="SwitchThemeBtn" Text="Switch ALL APP Theme" Command="{Binding Source={x:Reference Self}, Path=SwitchTheme}"/>
<Button Text="BasicComponents" Command="{Binding BasicComponents}"/>
<Button Text="SectionForm" Command="{Binding SectionForm}"/>
<Button Text="Indicators" Command="{Binding Indicators}"/>
<Button Text="SectionSheet" Command="{Binding SectionSheet}"/>
<Button Text="ExpanderCard" Command="{Binding ExpanderCard}"/>
<Button Text="TopAppBar" Command="{Binding TopAppBar}"/>
<Button Text="Separator" Command="{Binding Separators}" />
<Button Text="Button" Command="{Binding Button}"/>
<Button Text="Inputs" Command="{Binding Inputs}"/>
</StackLayout>
<ScrollView>
<StackLayout>
<Button x:Name="SwitchThemeBtn" Text="Switch ALL APP Theme" Command="{Binding Source={x:Reference Self}, Path=SwitchTheme}"/>
<Button Text="BasicComponents" Command="{Binding BasicComponents}"/>
<Button Text="SectionForm" Command="{Binding SectionForm}"/>
<Button Text="Indicators" Command="{Binding Indicators}"/>
<Button Text="SectionSheet" Command="{Binding SectionSheet}"/>
<Button Text="ExpanderCard" Command="{Binding ExpanderCard}"/>
<Button Text="TopAppBar" Command="{Binding TopAppBar}"/>
<Button Text="Separator" Command="{Binding Separators}" />
<Button Text="Button" Command="{Binding Button}"/>
<Button Text="Inputs" Command="{Binding Inputs}"/>
<Button Text="Layouts" Command="{Binding Layouts}"/>
</StackLayout>
</ScrollView>
</ContentPage>
7 changes: 6 additions & 1 deletion Smartway.UiComponent.Sample/MainPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,17 @@ public class MainPageViewModel : ViewModel

public ICommand Button => new Command(async () =>
{
await NavigateTo(new Buttons.Button());
await NavigateTo(new Buttons.Button{BindingContext = new ButtonViewModel()});
});

public ICommand Inputs => new Command(async () =>
{
await NavigateTo(new Inputs.Views.Inputs{ BindingContext = new InputsViewModel()});
});

public ICommand Layouts => new Command(async () =>
{
await NavigateTo(new Layouts.LayoutsSample());
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<EmbeddedResource Update="Basics\BasicComponents.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Layouts\LayoutsSample.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="SectionSheet\Views\SectionSheetSample.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
Expand Down
21 changes: 21 additions & 0 deletions Smartway.UiComponent/Layouts/ScannableLayout.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:buttons="clr-namespace:Smartway.UiComponent.Buttons;assembly=Smartway.UiComponent"
x:Name="Self"
x:Class="Smartway.UiComponent.Layouts.ScannableLayout">
<ContentView.Content>
<RelativeLayout>
<ContentView
Content="{Binding LayoutContent, Source={x:Reference Self}}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" >
</ContentView>
<buttons:ScanButton
Command="{Binding ScanButton}"
RelativeLayout.XConstraint="272"
RelativeLayout.YConstraint="480"/>
</RelativeLayout>
</ContentView.Content>
</ContentView>
22 changes: 22 additions & 0 deletions Smartway.UiComponent/Layouts/ScannableLayout.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Smartway.UiComponent.Layouts
{
[ContentProperty("LayoutContent")]
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ScannableLayout
{
public static readonly BindableProperty LayoutContentProperty = BindableProperty.Create(nameof(LayoutContent), typeof(View), typeof(ScannableLayout));

public ScannableLayout()
{
InitializeComponent();
}
public View LayoutContent
{
get => (View)GetValue(LayoutContentProperty);
set => SetValue(LayoutContentProperty, value);
}
}
}
8 changes: 8 additions & 0 deletions Smartway.UiComponent/Smartway.UiComponent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<None Remove="Resources\Icons\orange_icon_arrow_down.png" />
<None Remove="Resources\Icons\orange_icon_warning.png" />
<None Remove="Resources\Images\icon_gencode.png" />
<None Remove="Resources\Images\icon_scan.png" />
<None Remove="Resources\Images\img_product_placeholder.png" />
<None Remove="Resources\Images\img_product_placeholder_multilocation.png" />
<None Remove="Resources\Images\logo_easyturn.png" />
Expand All @@ -27,6 +28,7 @@
<EmbeddedResource Include="Resources\Images\icon_arrow_back.png" />
<EmbeddedResource Include="Resources\Images\icon_close.png" />
<EmbeddedResource Include="Resources\Images\icon_gencode.png" />
<EmbeddedResource Include="Resources\Images\icon_scan.png" />
<EmbeddedResource Include="Resources\Images\img_product_placeholder.png" />
<EmbeddedResource Include="Resources\Images\img_product_placeholder_multilocation.png" />
<EmbeddedResource Include="Resources\Images\logo_easyturn.png" />
Expand All @@ -44,6 +46,9 @@
<Compile Update="Buttons\Button.xaml.cs">
<DependentUpon>Button.xaml</DependentUpon>
</Compile>
<Compile Update="Buttons\ScanButton.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<Compile Update="Cards\CustomExpander.xaml.cs">
<DependentUpon>CustomExpander.xaml</DependentUpon>
</Compile>
Expand All @@ -53,6 +58,9 @@
<Compile Update="Inputs\Barcode\BarcodeInput.xaml.cs">
<DependentUpon>BarcodeInput.xaml</DependentUpon>
</Compile>
<Compile Update="Layouts\ScannableLayout.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand Down

0 comments on commit 8ff9633

Please sign in to comment.