Comments (7)
What are your thoughts on an html/css style relationship with universal Style
object and properties on Views
. Could be interesting for allowing custom handlers to implement certain styles types on views where you might not expect them rather than putting individual style properties on each view.
For example, a CornerRadius
or BorderRadius
might not make sense for default Label
, but if I wanted to implement a handler for it, I could on my own. Then you could also implement style classes with strongly typed classes. Here's a dumb and simplified example of what I'm getting at:
class Style
{
public virtual string Color { get; set; }
public virtual string BackgroundColor { get; set; }
public virtual float LetterSpacing { get; set; }
// and like tons more properties
}
class H1Style : Style
{
public H1Style()
{
Color = "#000000";
}
}
class View
{
public Style Style { get; set; }
}
// ...
var myStack = new HStack { new Label { Style = new H1Style() } };
from comet.
@SuavePirate I am looking into Style stuff. I was thinking more StyleID driven. So you would set the styles up once. https://github.com/Clancey/Comet/tree/material-design I haven't started on H1 type things yet. That is coming. But going this route, it should be nicer since we can do global styles. And have Style.Apply()
from comet.
Love it. I suppose you could pretty easily implement H1 type things by just subclassing components with a default StyleID as well. Let me know how I can help!
from comet.
So here is a current screen shot created from the following code:
public class TextStylesSample : View
{
[Body]
View body() => new VStack
{
new Text("H1").StyleAsH1(),
new Text("H2").StyleAsH2(),
new Text("H3").StyleAsH3(),
new Text("H4").StyleAsH4(),
new Text("H5").StyleAsH5(),
new Text("H6").StyleAsH6(),
new Text("Subtitle 1").StyleAsSubtitle1(),
new Text("Subtitle 2").StyleAsSubtitle2(),
new Text("Body 1").StyleAsBody1(),
new Text("Body 2").StyleAsBody2(),
new Text("Caption").StyleAsBody2(),
new Text("OVERLINE").StyleAsOverline(),
};
}
Added with this Commit
from comet.
Are they applied as extension methods? What does creating your own one-off StyleAs
methods look like? Love the fluent setup though
from comet.
So right now all the extension does is assign a StyleId, Then the properties for the style are set to the environment. Thats about all there is too it. I am making a style class so you can easily fill out the default properties, then tell it to apply. It will then auto assign things to the right spot in the environment. https://github.com/Clancey/Comet/blob/material-design/src/Comet/Styles/Style.cs#L168
from comet.
Done for most basic controls, I will keep going on the rest of them!
from comet.
Related Issues (20)
- .NET MAUI Comet App template can't build - AndroidManifest bad path HOT 4
- Text doesn't update properly HOT 3
- ListView doesn't show duplicate items HOT 3
- Template versioning HOT 1
- Issues with Hot reload HOT 3
- Is it possible to rerender a view when a Observable collection gets changed? HOT 2
- How to deal with DTOs HOT 1
- Failed when running : dotnet build RideTheComet -t:Run -f net6.0-android HOT 10
- When is the release version planned? HOT 3
- Styling doesn't apply based on ControlState HOT 1
- Implement ImageButton HOT 2
- Will comet still be developed after Clancey have left Microsoft or it is a death of the project ?? HOT 6
- Rendering issues after resizing the app window on windows
- View update not working on windows HOT 1
- Don't find the runtime package for ios HOT 2
- Avalonia UI support? HOT 3
- Can we hope that Comet will be officially supported soon ?
- Any issue from Comet please raise on https://github.com/flyperstudio/Comet HOT 2
- What is the future of this lib? HOT 2
- Dark/Light Mode?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comet.