Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.FFImageLoading.Forms">
<Version>2.4.11.982</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.778476-pre1" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.2.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected override void OnCreate(Bundle savedInstanceState)

global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.FFImageLoading.Forms">
<Version>2.4.11.982</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.778476-pre1" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.2.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
<PackageReference Include="Xamarin.Forms" Version="4.3.0.778476-pre1" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Models\" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
<PackageReference Include="Xamarin.Forms.PancakeView" Version="1.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace CarouselViewChallenge.Models
{
public class CategoryClass
{
public string ImageUrl { get; set; }
public string Text { get; set; }
public string SubText { get; set; }
public string GradientStartColor { get; set; }
public string GradientEndColor { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace CarouselViewChallenge.Models
{
public class CorousalClass
{
public string ImageUrl { get; set; }
public string Text { get; set; }
public string Count { get; set; }
public string Amount { get; set; }
public string GradientStartColor { get; set; }
public string GradientEndColor { get; set; }

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using CarouselViewChallenge.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace CarouselViewChallenge.ViewModels
{
public class CarouselViewChallengeViewModel
{ public List<CorousalClass> CorousalClassList { get; set; } = new List<CorousalClass>();

public List<CategoryClass> CategoryClassList { get; set; } = new List<CategoryClass>();


}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,191 @@
<?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"
mc:Ignorable="d"
x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage">
<ContentPage
x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage"
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:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pancake="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
mc:Ignorable="d">
<ContentPage.Content>
<StackLayout BackgroundColor="#cfd8dc">
<Label Text="You can use this page for the CarouselView Challenge!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
</StackLayout>
<ScrollView Orientation="Vertical">
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="70" />
<RowDefinition Height="230" />
<RowDefinition Height="70" />
<RowDefinition Height="120" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>

<SearchBar
Grid.Row="0"
BackgroundColor="#EFF0F2"
Placeholder="Search Courses"
VerticalOptions="FillAndExpand" />

<Label
Grid.Row="1"
CharacterSpacing="1"
FontAttributes="Bold"
FontSize="30"
Text="Popular Courses"
TextColor="#100b36"
VerticalTextAlignment="Center" />

<CarouselView
Grid.Row="2"
HorizontalScrollBarVisibility="Never"
ItemsLayout="HorizontalList"
ItemsSource="{Binding CorousalClassList}"
PeekAreaInsets="20,0,40,0">
<CarouselView.ItemTemplate>
<DataTemplate>
<Grid Padding="5">
<pancake:PancakeView
BackgroundGradientAngle="135"
BackgroundGradientEndColor="{Binding GradientStartColor}"
BackgroundGradientStartColor="{Binding GradientEndColor}"
CornerRadius="10"
Elevation="1"
IsClippedToBounds="True"
WidthRequest="200">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="2*" />
<RowDefinition Height="1.2*" />
</Grid.RowDefinitions>
<ffimageloading:CachedImage
Grid.Row="0"
DownsampleToViewSize="true"
HorizontalOptions="Start"
Source="{Binding ImageUrl}"
VerticalOptions="Center"
WidthRequest="60" />
<Label
Grid.Row="1"
FontAttributes="Bold"
FontSize="25"
Text="{Binding Text}"
TextColor="White"
VerticalTextAlignment="Center" />
<StackLayout Grid.Row="2" Orientation="Horizontal">
<Label
FontSize="15"
HorizontalTextAlignment="Start"
Text="{Binding Count}"
TextColor="White"
VerticalTextAlignment="Center" />

<Frame
Margin="10"
Padding="5"
CornerRadius="15"
HorizontalOptions="EndAndExpand">

<Label
FontAttributes="Bold"
HorizontalTextAlignment="Center"
Text="{Binding Amount}"
WidthRequest="50" />
</Frame>
</StackLayout>
</Grid>

</pancake:PancakeView>
</Grid>

</DataTemplate>
</CarouselView.ItemTemplate>


</CarouselView>


<StackLayout Grid.Row="3" Orientation="Horizontal">
<Label
CharacterSpacing="1"
FontAttributes="Bold"
FontSize="25"
HorizontalOptions="Start"
Text="Top Categories"
TextColor="#040122"
VerticalTextAlignment="Center" />

<Label
CharacterSpacing="0.6"
FontSize="18"
HorizontalOptions="EndAndExpand"
Text="View All"
TextColor="#372972"
VerticalTextAlignment="Center" />
</StackLayout>



<CollectionView
Grid.Row="4"
HorizontalScrollBarVisibility="Never"
ItemsLayout="HorizontalList"
ItemsSource="{Binding CategoryClassList}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="5">
<pancake:PancakeView
BackgroundGradientAngle="135"
BackgroundGradientEndColor="{Binding GradientStartColor}"
BackgroundGradientStartColor="{Binding GradientEndColor}"
CornerRadius="10"
Elevation="1"
IsClippedToBounds="True"
WidthRequest="150">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="1.2*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ffimageloading:CachedImage
Grid.Row="0"
DownsampleToViewSize="true"
HorizontalOptions="Start"
Source="{Binding ImageUrl}"
VerticalOptions="Center"
WidthRequest="60" />
<Label
Grid.Row="1"
CharacterSpacing="0.7"
FontAttributes="Bold"
FontSize="18"
Text="{Binding Text}"
TextColor="White"
VerticalTextAlignment="Center" />

<Label
Grid.Row="2"
FontSize="13"
Text="{Binding SubText}"
TextColor="White"
VerticalTextAlignment="Center" />

</Grid>

</pancake:PancakeView>
</Grid>

</DataTemplate>
</CollectionView.ItemTemplate>


</CollectionView>



</Grid>

</ScrollView>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using CarouselViewChallenge.Models;
using CarouselViewChallenge.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -15,6 +17,68 @@ public partial class CarouselViewChallengePage : ContentPage
public CarouselViewChallengePage()
{
InitializeComponent();

BindingContext = new CarouselViewChallengeViewModel
{
CorousalClassList = new List<CorousalClass>()
{
new CorousalClass
{
Text = "Universal Principle of Design",
Count = "10,023 Learners",
Amount = "$109",
ImageUrl = "https://devoirtech.com/pen.png",
GradientStartColor="#7655EE",
GradientEndColor="#A875EB"

},
new CorousalClass
{
Text = "User Experiance Design Fundamentals",
Count = "10,023 Learners",
Amount = "$109",
ImageUrl = "https://devoirtech.com/pen.png",
GradientStartColor="#fa8765",
GradientEndColor="#e686cd"
}
}

,
CategoryClassList = new List<CategoryClass>() {
new CategoryClass
{
Text = "Marketing",
SubText = "25 Cources",

ImageUrl = "https://devoirtech.com/pie.png",
GradientStartColor="#27a9ff",
GradientEndColor="#05d8ea"

},
new CategoryClass
{
Text = "Development",
SubText = "25 Cources",

ImageUrl = "https://devoirtech.com/coding.png",
GradientStartColor="#fd7e60",
GradientEndColor="#fcaa76"

},
new CategoryClass
{
Text = "Photography",
SubText = "25 Cources",

ImageUrl = "https://devoirtech.com/camera.png",
GradientStartColor="#07eab7",
GradientEndColor="#5aeba8"

}
}
};
}
}


}