|
1 |
| -using System.Reflection; |
| 1 | +using DXImage = DevExpress.Maui.Core.DXImage; |
2 | 2 |
|
3 |
| -namespace MyFinance.Views |
| 3 | +namespace MyFinance.Views; |
| 4 | + |
| 5 | +public partial class MainPage(MainPageViewModel viewModel) : BasePage<MainPageViewModel>(viewModel, "Main Page") |
4 | 6 | {
|
5 |
| - public partial class MainPage(MainPageViewModel viewModel) : BasePage<MainPageViewModel>(viewModel, "Main Page") |
| 7 | + public override void Build() |
6 | 8 | {
|
7 |
| - public override void Build() |
8 |
| - { |
9 |
| - var version = typeof(MauiApp).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion; |
| 9 | + this |
| 10 | + .Content( |
| 11 | + new VerticalStackLayout() |
| 12 | + .Spacing(20) |
| 13 | + .Margin(20,20,20,10) |
| 14 | + .Children( |
| 15 | + new HorizontalStackLayout() |
| 16 | + .AlignStart() |
| 17 | + .Spacing(5) |
| 18 | + .Children( |
| 19 | + new DXImage() |
| 20 | + .Source("profile.png") |
| 21 | + .SizeRequest(60,60), |
10 | 22 |
|
11 |
| - this |
12 |
| - .Content( |
13 |
| - new ScrollView() |
14 |
| - .Content( |
15 |
| - new Grid() |
16 |
| - .RowDefinitions(e => e.Star(90).Star(10)) |
17 |
| - .Children( |
18 |
| - new StackLayout() |
19 |
| - .Spacing(25) |
20 |
| - .Children( |
21 |
| - new Label() |
22 |
| - .Text("Hello, World!") |
23 |
| - .FontSize(32) |
24 |
| - .CenterHorizontal() |
25 |
| - .SemanticHeadingLevel(SemanticHeadingLevel.Level1), |
| 23 | + new VerticalStackLayout() |
| 24 | + .CenterVertical() |
| 25 | + .Children( |
| 26 | + new Label() |
| 27 | + .FontAttributes(Bold) |
| 28 | + .TextColor(Black) |
| 29 | + .Text("Lilliie-May Mcdonelli"), |
26 | 30 |
|
27 |
| - new Label() |
28 |
| - .Text("Welcome to .NET Multi-platform App UI") |
29 |
| - .FontSize(18) |
30 |
| - .CenterHorizontal() |
31 |
| - .SemanticDescription("Welcome to dot net Multi platform App U I") |
32 |
| - .SemanticHeadingLevel(SemanticHeadingLevel.Level1), |
| 31 | + new Label() |
| 32 | + .TextColor(Gray) |
| 33 | + |
| 34 | + ) |
| 35 | + ), |
33 | 36 |
|
34 |
| - new Label() |
35 |
| - .Text("Current count: 0") |
36 |
| - .FontSize(18) |
37 |
| - .FontAttributes(Bold) |
38 |
| - .CenterHorizontal() |
39 |
| - .Assign(out CounterLabel), |
| 37 | + new VerticalStackLayout() |
| 38 | + .Spacing(-3) |
| 39 | + .Children( |
| 40 | + new Label() |
| 41 | + .FontAttributes(Bold) |
| 42 | + .TextColor(Black) |
| 43 | + .Text("Total balance"), |
40 | 44 |
|
41 |
| - new Button() |
42 |
| - .Text("Click me") |
43 |
| - .CenterHorizontal() |
44 |
| - .InvokeOnElement(btn => btn.Clicked += OnCounterClicked) |
45 |
| - .SemanticHint("Counts the number of times you click"), |
| 45 | + new Grid() |
| 46 | + .RowDefinitions(e => e.Star().Star()) |
| 47 | + .ColumnDefinitions(e => e.Star(7).Star(3)) |
| 48 | + .Spacing(10,3) |
| 49 | + .Children( |
| 50 | + new Label() |
| 51 | + .Text("25,291.50 ₺") |
| 52 | + .FontAttributes(Bold) |
| 53 | + .FontSize(40) |
| 54 | + .RowSpan(2), |
46 | 55 |
|
47 |
| - new Image() |
48 |
| - .Source("dotnet_bot.png") |
49 |
| - .WidthRequest(250) |
50 |
| - .HeightRequest(310) |
51 |
| - .CenterHorizontal() |
52 |
| - .SemanticDescription("Cute dot net bot waving hi to you!") |
53 |
| - ), |
| 56 | + new Label() |
| 57 | + .Text("+130.65%") |
| 58 | + .TextColor(Green) |
| 59 | + .FontSize(12) |
| 60 | + .Column(1) |
| 61 | + .AlignBottomEnd(), |
54 | 62 |
|
55 |
| - new Grid() |
56 |
| - .BackgroundColor(AppColors.Primary) |
57 |
| - .Row(1) |
58 |
| - .Children( |
59 |
| - new Label() |
60 |
| - .Text($"dotNet version: {version}") |
61 |
| - .TextColor(White) |
62 |
| - .Center() |
63 |
| - ) |
64 |
| - ) |
| 63 | + new Label() |
| 64 | + .Text("+2,367.72₺") |
| 65 | + .TextColor(DarkGray) |
| 66 | + .FontSize(12) |
| 67 | + .Column(1) |
| 68 | + .Row(1) |
| 69 | + .AlignTopEnd() |
65 | 70 | )
|
| 71 | + ), |
66 | 72 |
|
67 |
| - ); |
68 |
| - } |
| 73 | + new Grid() |
| 74 | + .ColumnDefinitions(e => e.Star().Star()) |
| 75 | + .ColumnSpacing(10) |
| 76 | + .Children( |
| 77 | + new DXButton() |
| 78 | + .HeightRequest(100) |
| 79 | + .Content("Buy") |
| 80 | + .TextColor(White) |
| 81 | + .FontSize(16) |
| 82 | + .ButtonType(Accent) |
| 83 | + .Icon("up_arrow.png") |
| 84 | + .IconColor(Red) |
| 85 | + .CornerRadius(new CornerRadius(20)) |
| 86 | + .BackgroundColor(Black), |
69 | 87 |
|
70 |
| - private int _count = 0; |
71 |
| - private Label CounterLabel; |
| 88 | + new DXButton() |
| 89 | + .HeightRequest(100) |
| 90 | + .Content("Sell") |
| 91 | + .TextColor(Black) |
| 92 | + .FontSize(16) |
| 93 | + .ButtonType(Accent) |
| 94 | + .Icon("down_arrow.png") |
| 95 | + .IconColor(Green) |
| 96 | + .CornerRadius(new CornerRadius(20)) |
| 97 | + .BackgroundColor(DeepSkyBlue) |
| 98 | + .BorderColor(Black) |
| 99 | + .BorderThickness(1) |
| 100 | + .Column(1) |
| 101 | + ), |
72 | 102 |
|
| 103 | + new Frame() |
| 104 | + .CornerRadius(20) |
| 105 | + .BorderColor(Black) |
| 106 | + .BackgroundColor(Transparent) |
| 107 | + .Content( |
| 108 | + new VerticalStackLayout() |
| 109 | + .FillBothDirections() |
| 110 | + .Children( |
| 111 | + new Label() |
| 112 | + .FontAttributes(Bold) |
| 113 | + .TextColor(Black) |
| 114 | + .Text("Watchlist"), |
| 115 | + |
| 116 | + new Border() |
| 117 | + .StrokeThickness(1), |
73 | 118 |
|
74 |
| - private void OnCounterClicked(object? sender, EventArgs e) |
75 |
| - { |
76 |
| - _count++; |
77 |
| - CounterLabel.Text = $"Current count: {_count}"; |
| 119 | + new DXCollectionView() |
| 120 | + .ItemsSource(e => e.Path("")) |
| 121 | + .IsRefreshing(e => e.Path("").BindingMode(TwoWay)) |
| 122 | + .ItemTemplate(() => |
| 123 | + new Grid() |
| 124 | + .RowDefinitions(e => e.Star().Star()) |
| 125 | + .ColumnDefinitions(e => e.Star(1).Star(6).Star(3)) |
| 126 | + .Margin(5) |
| 127 | + .Children( |
| 128 | + new DXImage() |
| 129 | + .Source(e => e.Path("")) |
| 130 | + .SizeRequest(40,40) |
| 131 | + .RowSpan(2) |
78 | 132 |
|
79 |
| - SemanticScreenReader.Announce(CounterLabel.Text); |
80 |
| - } |
| 133 | + ) |
| 134 | + ) |
| 135 | + ) |
| 136 | + ) |
| 137 | + ) |
| 138 | + ); |
81 | 139 | }
|
82 | 140 | }
|
0 commit comments